I want to send e-mail with log in it body. I write in console:
/tool e-mail send to=example@example.com subject=("log") body=([/log print])
It put all log in console and I recieve empty e-mail. How I can put log in the e-mail body?
(sorry for my english)
Hi dear friend,
For this, You need to set up a new action in /system logging action add name=file target=disk disk-file-name=log
and then make everything log using this new action:
/system logging action=file
You can see in /file , a file with name “log.0.txt” has been created.
Then you can mail log file to yourself:
/tool e-mail send to=example@example.com subject=(“log”) body=(“”) file=log.0.txt
If it was useful for you, Don’t forget to give Karma!!
sadeghrafie:
Hi dear friend,
For this, You need to set up a new action in /system logging action add name=file target=disk disk-file-name=log
and then make everything log using this new action:
/system logging action=file
You can see in /file , a file with name “log.0.txt” has been created.
Then you can mail log file to yourself:
/tool e-mail send to=example@example.com subject=(“log”) body=(“”) file=log.0.txt
If it was useful for you, Don’t forget to give Karma!!
Thanks, but I already use it. My question is - how to put a text of a log in email body. Not in attachment.
mrz
October 14, 2011, 6:21am
4
Whole log?
:global logMessages;
:foreach i in=[/log find ] do={ :set logMessages ($logMessages . [get $i message ]); }
/tool e-mail send body=$logMessages;
Yes - whole log (I send it on startup - log small). Is there an error?
Thank you very much, mrz .
All log writing in one line, need the transfer line. So, my last version of your script:
:global logMessages;
:set logMessages ""
:foreach i in=[/log find ] do={
:set logMessages ($logMessages . [/log get $i message ]);
:set logMessages ($logMessages . "\n")
}
/tool e-mail send to=example@example.com body=$logMessages;
And with date)
:global logMessages;
:set logMessages ""
:foreach i in=[/log find ] do={
:set logMessages ($logMessages . [/log get $i time ] . " ");
:set logMessages ($logMessages . [/log get $i message ]);
:set logMessages ($logMessages . "\n")
}