script send logs with l2tp connections no work

Hi all
Until recently this script that I put below worked fine but since I put 6.49 it has stopped working
The script was implemented in its day to send every night a list with the L2TP connections that happened during the day and the active connections at the time of sending the log
For some unknown reason it has stopped working and it is important that it works again
Apart from this we have now implemented SSTP connections or soon we hope to implement when we migrate to 7.1 wireguard or openvpn, how can we modify this script so that it logs all VPN connections?


###/log print file=ppplog.0.txt

:global voldvlist
:global l2tplist "L2TP interfaces \n \n"
:global vlist
:global int


:set l2tplist "$l2tplist SERVERS: \n" ;
:foreach int in=[/interface l2tp-server find] do={
:set l2tplist "$l2tplist L2TP: $[/interface l2tp-server get $int name] : $[/interface l2tp-server get $int running] \n" ;
:if ( [/interface l2tp-server get $int running] = true ) do={
:log error "L2TP: $[/interface l2tp-server get $int name] : true" ;
}
}

:set l2tplist "$l2tplist \n \n CLIENTS: \n" ;
:foreach int in=[/interface l2tp-client find] do={
:set l2tplist "$l2tplist L2TP: $[/interface l2tp-client get $int name] : $[/interface l2tp-client get $int running] \n" ;
:if ( [/interface l2tp-client get $int running] = true ) do={
:log error "L2TP: $[/interface l2tp-client get $int name] : true" ;
}
}
:set vlist "** Active VPN list ** \n \n \n $l2tplist"

:if ( $oldvlist != $vlist) do={
/tool e-mail send body="$vlist" subject="VPN" to="email1@server.com" file=ppplog.0.txt
:set voldvlist $vlist
:log error "VPN MCHard status list sent"
/tool e-mail send body="$vlist" subject="VPN" to="email2@server.com" file=ppplog.0.txt
:set voldvlist $vlist
:log error "VPN NewBlock status list sent"
:delay 30s

/file remove ppplog.0.txt

} else={
:log error "VPN no change"
}


in the body of the email it puts this

** Active VPN list **


L2TP interfaces

SERVERS:
L2TP: : true


CLIENTS:


And an attached file with a text similar to this:

Jan/20/2022 01:55:47 l2tp,info first L2TP UDP packet received from 89.141.146.96
Jan/20/2022 01:55:47 l2tp,ppp,info,account User1VPN logged in, 192.168.xxx.3 from
Jan/20/2022 01:55:47 l2tp,ppp,info : authenticated
Jan/20/2022 01:55:47 l2tp,ppp,info : connected
Jan/20/2022 02:49:02 l2tp,info first L2TP UDP packet received from 146.88.240.4
Jan/20/2022 06:04:49 l2tp,info first L2TP UDP packet received from 81.184.153.91
Jan/20/2022 06:04:49 l2tp,ppp,info,account User2VPN logged in, 192.168.xxx.6 from
Jan/20/2022 06:04:49 l2tp,ppp,info : authenticated
Jan/20/2022 06:04:49 l2tp,ppp,info : connected
Jan/20/2022 07:49:54 l2tp,ppp,info : terminating...
Jan/20/2022 07:49:54 l2tp,ppp,info,account User2VPN logged out, 6306 15483745 193332136 271268 304635 from
Jan/20/2022 07:49:54 l2tp,ppp,info : disconnected
Jan/20/2022 09:09:35 l2tp,info first L2TP UDP packet received from 79.153.191.168
Jan/20/2022 09:09:35 l2tp,ppp,info,account McHard logged in, 192.168.xxxx.1 from
Jan/20/2022 09:09:35 l2tp,ppp,info : authenticated
Jan/20/2022 09:09:35 l2tp,ppp,info : connected

and t

I can not see any obvious reason for the script has stopped.
But please use code tags when post data </> button above the post.
I have reformatted the post and removed unneeded ; at the end of lines to make it easier to read.

###/log print file=ppplog.0.txt

:global voldvlist
:global l2tplist "L2TP interfaces \n \n"
:global vlist
:global int

:set l2tplist "$l2tplist SERVERS: \n"
:foreach int in=[/interface l2tp-server find] do={
	:set l2tplist "$l2tplist L2TP: $[/interface l2tp-server get $int name] : $[/interface l2tp-server get $int running] \n"
	:if ( [/interface l2tp-server get $int running] = true ) do={
		:log error "L2TP: $[/interface l2tp-server get $int name] : true"
	}
}

:set l2tplist "$l2tplist \n \n CLIENTS: \n"
:foreach int in=[/interface l2tp-client find] do={
	:set l2tplist "$l2tplist L2TP: $[/interface l2tp-client get $int name] : $[/interface l2tp-client get $int running] \n"
	:if ( [/interface l2tp-client get $int running] = true ) do={
		:log error "L2TP: $[/interface l2tp-client get $int name] : true"
	}
}
:set vlist "** Active VPN list ** \n \n \n $l2tplist"

:if ( $oldvlist != $vlist) do={
	/tool e-mail send body="$vlist" subject="VPN" to="email1@server.com" file=ppplog.0.txt
	:set voldvlist $vlist
	:log error "VPN MCHard status list sent"
	/tool e-mail send body="$vlist" subject="VPN" to="email2@server.com" file=ppplog.0.txt
	:set voldvlist $vlist
	:log error "VPN NewBlock status list sent"
	:delay 30s
	### /file remove ppplog.0.txt

} else={
	:log error "VPN no change"
}

PS
The Splunk tool that are in my signature do log all VPN both graphical and in table format. (and its free)

Hello
I have this script using it without problems in versions 6.xx, when updating to version 7 of RouterOs now it gives me an error when sending

I get an Invalid BODY error
It's wrong?


:global voldvlist
:global l2tplist "L2TP interfaces \n \n"
:global sstplist "SSTP interfaces \n \n"
:global vlist
:global int


:set l2tplist "$l2tplist SERVERS: \n" ;
:foreach int in=[/interface l2tp-server find] do={
:set l2tplist "$l2tplist L2TP: $[/interface l2tp-server get $int name] : $[/interface l2tp-server get $int running] \n" ;
:if ( [/interface l2tp-server get $int running] = true ) do={
:log error "L2TP: $[/interface l2tp-server get $int name] : true" ;
}
}

:set sstplist "$sstplist SERVERS: \n" ;
:foreach int in=[/interface sstp-server find] do={
:set sstplist "$sstplist L2TP: $[/interface sstp-server get $int name] : $[/interface sstp-server get $int running] \n" ;
:if ( [/interface sstp-server get $int running] = true ) do={
:log error "SSTP: $[/interface sstp-server get $int name] : true" ;
}
}

:set vlist "** Active VPN list ** \n \n \n $l2tplist \n \n \n $sstplist"

###:if ( $oldvlist != $vlist) do={
/tool e-mail send body="$vlist" subject="VPN" to="xx@xx2.com" file=ppplog.0.txt
:set voldvlist $vlist
:log error "VPN status list sent"
/tool e-mail send body="$vlist" subject="VPN" to="xx@xx1.com" file=ppplog.0.txt
:set voldvlist $vlist
:log error "VPN client status list sent"
:delay 30s
/file remove ppplog.0.txt
/file remove ppplog.txt


###} else={

:log error "VPN no change"

###}