Community discussions

MikroTik App
 
User avatar
otgooneo
Trainer
Trainer
Topic Author
Posts: 581
Joined: Tue Dec 01, 2009 3:24 am
Location: Mongolia
Contact:

Send log via e-mail

Wed Jun 15, 2011 8:05 am

Hi guys,
I want to set script when
/ip dhcp-server alert
detected rogue DHCP server, I want to send e-mail included alert log. But there is some error. Please tell me where is the mistake:
/tool e-mail send to=sample@example.com subject="TEST" body=[/log get value-name=message \
number=[/log print where topics=dhcp,critical,error]] from=alert@example.com
When script works ok. I will set this script to
 /ip dhcp-server alert add on-alert=
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Send log via e-mail

Wed Jun 15, 2011 10:37 am

I can advice different approach,
- configure /system logging action, and add new target=remote rule;
- set e-mail-to parameter to your e-mail address;
- configure /system logging to use new action for dhcp,critical,error logs;
- do not forget to set SMTP server at /tool e-mail menu;
 
User avatar
otgooneo
Trainer
Trainer
Topic Author
Posts: 581
Joined: Tue Dec 01, 2009 3:24 am
Location: Mongolia
Contact:

Re: Send log via e-mail

Thu Jun 16, 2011 6:55 am

Wooow yes, of course it is very simple in that way. Sorry for my stupid question and try. Thanks sergejs.
But I have one more easy question. How can I set more that 2 e-mail addresses on
/system logging action add email-to=
?
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Send log via e-mail

Thu Jun 16, 2011 8:19 am

otgooneo, you need to make two /system logging action entries like
[admin@MikroTik] /system logging action> print
Flags: * - default
 #   NAME             TARGET REMOTE
 0 * memory           memory
 1 * disk             disk
 2 * echo             echo
 3 * remote           remote
 4   1                remote
 5   2                remote
 
User avatar
otgooneo
Trainer
Trainer
Topic Author
Posts: 581
Joined: Tue Dec 01, 2009 3:24 am
Location: Mongolia
Contact:

Re: Send log via e-mail

Fri Jun 17, 2011 9:32 am

Okay. Thank you. I will do.
 
Phalanx00
just joined
Posts: 17
Joined: Wed Jan 19, 2011 9:45 am

Re: Send log via e-mail

Sun Jul 10, 2011 9:23 pm

Hi, I set emails about info actions and it's great, but is there any option to send little more informations?

email now
Header: system,info log rule added by admin
Body: empty

email future (I hope) :lol:
header: router's ip + name
body: like header email now, actual datetime

commands for name or datetime are simple, but is there any way how to customize messages via email?
Thank you
 
Phalanx00
just joined
Posts: 17
Joined: Wed Jan 19, 2011 9:45 am

Re: Send log via e-mail

Tue Jul 12, 2011 11:27 pm

Nobody? :(
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Send log via e-mail

Tue Jul 19, 2011 11:43 am

It is not possible to change current format of e-mail logs.
It might be possible in future.
 
hngjared
Frequent Visitor
Frequent Visitor
Posts: 77
Joined: Thu Dec 01, 2011 8:36 pm
Location: NYC USA

Re: Send log via e-mail

Mon Jan 06, 2014 10:15 pm

I agree with Phalanx00.

This is a great option but when you have hundreds of networks it would be nice to know where the emails are coming from aside from looking in the email header.

Has there been any improvements to this?
 
tikcc
just joined
Posts: 4
Joined: Tue Dec 01, 2020 11:47 pm

Re: Send log via e-mail

Tue Nov 21, 2023 10:23 pm

It has been a few years, do we have any hope for a few additional options for email logs? Having the ability to set a custom subject would be extremely useful.

It is not possible to change current format of e-mail logs.
It might be possible in future.
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1071
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Send log via e-mail

Tue Nov 21, 2023 11:35 pm

I can recommend to use my script for this:
https://git.eworm.de/cgit/routeros-scri ... forward.md

Who is online

Users browsing this forum: No registered users and 2 guests