Community discussions

MikroTik App
 
fruex
just joined
Topic Author
Posts: 1
Joined: Tue Aug 18, 2015 9:03 am

Log DHCP users on Mikrotik 6.31

Tue Sep 01, 2015 11:57 am

I would like to log users using network. I create own version from few different script to log dhcp assign operation on disk and sent it to me via e-mail.

/tool e-mail send to="xxx" subject=([/system identity get name] . " Log " . [/system clock get date]) file=("dhcpLog.0.txt");
:wait 10;
/file set [find name="dhcpLog.0.txt"] contents=""
:log info ("System Log emailed at " . [/sys cl get time] . " " . [/sys cl get date]);
I add new log

4 dhcp dhcpLog dhcpLog
!debug
!packet
and new action for it

4 name="dhcpLog" target=disk disk-file-name="dhcpLog"
disk-lines-per-file=10000 disk-file-count=1 disk-stop-on-full=no
once a day MT sent to me e-mail

But.. I am worry about this solution.

Between sending e-mail and delay I can lose some logs.
I set file with "" value because I can't create log file from script. With file, MT will not log. (How to create a new file by Mikrotik routers' scripting)
 
JJCinAZ
Member
Member
Posts: 475
Joined: Fri Oct 22, 2004 8:03 am
Location: Tucson, AZ

Re: Log DHCP users on Mikrotik 6.31

Wed Sep 02, 2015 6:05 pm

You could also look at transporting DHCP events to a central place using syslog. If you want to stick with the email-the-file method, look at rotating the log to a new file first, then email the old log.

Who is online

Users browsing this forum: No registered users and 38 guests