Thursday 12 June 2014

SCRIPT TO SAVE LOGS & SEND VIA EMAIL

Script to Save Logs & Send Via Email
Copy Paste on Mikrotik Terminal :)
1
2
3
4
5
6
7
8
9
10
11
/system script add name="LogDump" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff
#read log
:local logcontent
:foreach int in=[/log find ] do={
:set logcontent (“$logcontent\r\n” .[/log get $int time]. ” – ” .[/log get $int message])
}
#send email
/tool e-mail send to=”log@xxxx.xxx” subject=([/system identity get name] . ” Log ” . [/system clock get date]) body=$logcontent
#delete old log
/system logging action set memory memory-lines=1
/system logging action set memory memory-lines=65000

No comments:

Post a Comment