Community discussions

MUM Europe 2020
 
asis27
just joined
Topic Author
Posts: 4
Joined: Wed Mar 11, 2015 11:22 am

Cannot create a log file

Wed Mar 11, 2015 11:38 am

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.
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6621
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Cannot create a log file

Wed Mar 11, 2015 12:44 pm

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.
 
asis27
just joined
Topic Author
Posts: 4
Joined: Wed Mar 11, 2015 11:22 am

Re: Cannot create a log file

Wed Mar 11, 2015 1:30 pm

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!
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6621
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Cannot create a log file

Wed Mar 11, 2015 1:55 pm

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
 
User avatar
gabrielpike
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Thu Apr 17, 2014 4:17 pm

Re: Cannot create a log file

Wed Mar 11, 2015 2:24 pm

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
Gabriel Pike
MTCNA

Who is online

Users browsing this forum: balkyny, komdee, miquelmartos, omnet and 117 guests