Community discussions

MikroTik App
 
fahedksa
Member Candidate
Member Candidate
Topic Author
Posts: 107
Joined: Mon Nov 27, 2006 2:27 pm

send log file to email need help to fix

Sat Jan 17, 2009 9:33 am

Hay,
I try write script to make log file and send to my email but i dont know ehere the error
its made the file but it cant to send email

my script:

/log print file=([/system identity get name] . "Log-" . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]); \

/tool e-mail send to="xxx@xxxx.com" subject=([/system identity get name] . " Log " . \
[/system clock get date]) file=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".txt"); :delay 10; \
/file rem [/file find name=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".txt")]; \
:log info ("System Log emailed at " . [/sys cl get time] . " " . [/sys cl get date])
 
fahedksa
Member Candidate
Member Candidate
Topic Author
Posts: 107
Joined: Mon Nov 27, 2006 2:27 pm

Re: send log file to email need help to fix

Sat Jan 17, 2009 10:03 am

I fix it now and works fine


/log print file=([/system identity get name] . "Log-" . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]); \
/tool e-mail send to="xxxx@xxxx.com" subject=([/system identity get name] . " Log " . \
[/system clock get date]) file=([/system identity get name] . "Log-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".txt"); :delay 10; \
/file rem [/file find name=([/system identity get name] . "Log-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".txt")]; \
:log info ("System Log emailed at " . [/sys cl get time] . " " . [/sys cl get date])
 
botakedan
just joined
Posts: 2
Joined: Sun Aug 26, 2007 1:26 pm

Re: send log file to email need help to fix

Sat Dec 22, 2012 9:45 pm

Thanks...
this script is really helpfull
 
yaxir
just joined
Posts: 6
Joined: Wed Dec 18, 2013 7:56 am

Re: send log file to email need help to fix

Wed Dec 18, 2013 8:04 am

please also include a command to delete this log from mikrotik memory after emailing this script coz mikrotik have very low memory as u know already..
thanks and regards
 
User avatar
skot
Long time Member
Long time Member
Posts: 586
Joined: Wed Nov 30, 2011 3:05 am

Re: send log file to email need help to fix

Wed Dec 18, 2013 7:21 pm

please also include a command to delete this log from mikrotik memory after emailing this script coz mikrotik have very low memory as u know already..
thanks and regards
You can use the same code that created the file to remove it:

ros code

/file remove ([/system identity get name] . "Log-" . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]);
I don't need any karma... I have Ιησους Χριστος!
 
yaxir
just joined
Posts: 6
Joined: Wed Dec 18, 2013 7:56 am

Re: send log file to email need help to fix

Thu Dec 26, 2013 9:54 am

thanks buddy so how would be the full script after adding the line you mentioned. actually i am very new to this...
sorry for taking your time but it will be very helpful for the beginners like me.
 
yaxir
just joined
Posts: 6
Joined: Wed Dec 18, 2013 7:56 am

Re: send log file to email need help to fix

Thu Dec 26, 2013 10:44 am

please also include a command to delete this log from mikrotik memory after emailing this script coz mikrotik have very low memory as u know already..
thanks and regards
You can use the same code that created the file to remove it:

ros code

/file remove ([/system identity get name] . "Log-" . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]);

i have tried your lines in the end of script is not working... please if this is possible please re edited the whole script
regards
 
yaxir
just joined
Posts: 6
Joined: Wed Dec 18, 2013 7:56 am

Re: send log file to email need help to fix

Tue Dec 31, 2013 2:22 pm

facing an issue in the script...!

my email smtp server settings is ok..mikrotik can send emails except mikrotik logs file it gives error "invalid FROM address"
while it can it can send other emails and delete the created log file from memory. please have a look in snapshot.
You do not have the required permissions to view the files attached to this post.
 
User avatar
skot
Long time Member
Long time Member
Posts: 586
Joined: Wed Nov 30, 2011 3:05 am

Re: send log file to email need help to fix

Tue Dec 31, 2013 6:00 pm

Try entering a from="name" or email address when you send the message.

ros code

/tool e-mail send to="xxxx@xxxx.com" from="from@domain.com" subject=...
I don't need any karma... I have Ιησους Χριστος!
 
yaxir
just joined
Posts: 6
Joined: Wed Dec 18, 2013 7:56 am

Re: send log file to email need help to fix

Wed Jan 01, 2014 2:38 pm

Try entering a from="name" or email address when you send the message.

ros code

/tool e-mail send to="xxxx@xxxx.com" from="from@domain.com" subject=...
with tls=yes option including in the script it works...

cheers :)

thanks

Who is online

Users browsing this forum: No registered users and 32 guests