Wednesday, August 3, 2011

Script to save logs and send via email


Diambil dari forum.mikrotik.com
Script ini hanya berjalan di versi 3.x, di versi 2.9.x tidak berjalan, apalagi versi 2.9.27
Pastikan anda sudah mengisi server dan from di konfigurasi mikrotik.
/system script add name="LogDump" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source="
:local body
:foreach int in=[/log find ] do={
  :set body ("$body\r\n" . [/log get $int])
}
/tool e-mail send to="YOU@DOMAIN.COM" subject=([/system identity get name] . " Log " . [/system clock get date]) body=$body
/system logging action set memory memory-lines=1
/system logging action set memory memory-lines=100"
/system script add disabled=no interval=1d name="Run Log Dump" on-event=LogDump start-date=jan/01/1970 start-time=00:00:00