Page 1 of 1

Cannot create a log file

Posted: Wed Mar 11, 2015 11:38 am
by asis27
Hi! I am trying to create a log file to send it later via email.

I've created a filter rule:
Image

then in logging/rule:

Image

the in logging/actions:

Image


But in "files", the file cannot be created.

I appreciate any help.

Re: Cannot create a log file

Posted: Wed Mar 11, 2015 12:44 pm
by sergejs
You cannot make log file and then send it to e-mail.
But you can save logs to file or send to e-mail.

To save logs to files, make sure you have firewall logs with prefix block. Probably there are no such logs at the moment, that's why you do not see created file.
Try to experiment with "info" topics logs.

Re: Cannot create a log file

Posted: Wed Mar 11, 2015 1:30 pm
by asis27
You cannot make log file and then send it to e-mail.
But you can save logs to file or send to e-mail.

To save logs to files, make sure you have firewall logs with prefix block. Probably there are no such logs at the moment, that's why you do not see created file.
Try to experiment with "info" topics logs.
I've tried with "info", but no way!
Any idea?

Thanks anyway!

Re: Cannot create a log file

Posted: Wed Mar 11, 2015 1:55 pm
by sergejs
Your current rule make logs on disk.
You can see them by selecting "disk" in /log menu or /log print where buffer=disk

To setup logs to file, make sure to configure /system logging> action add disk-file-name=
http://wiki.mikrotik.com/wiki/Manual:Sy ... ng_to_file

Re: Cannot create a log file

Posted: Wed Mar 11, 2015 2:24 pm
by gabrielpike
Here is a script that will do it assuming you have the email tool already configured correctly. Change DEST_EMAIL_ADDRESS to your email. Just create new script in winbox and past the contents in the script source box.

#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="DEST_EMAIL_ADDRESS" subject=([/system identity get name] . " Log " . [/system clock get date]) body=$logcontent