0

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.

I would like to achieve information - how offen "known - by mac" people are using network (wifi).

/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.

  1. Between sending e-mail and delay I can lose some logs.
  2. 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)
Community
  • 1
  • 1
Adrian Botor
  • 362
  • 3
  • 17

1 Answers1

0

Instead of using MT scripting, you can log DHCP activity (or WIFI activity, if you need to focus on WIFI clients) to an external syslog server, which is more flexible (insert in a file-per-user, file-per-day, or database for example). Then, your log data can be parsed by a "real" scripting language like perl, with infinite reporting possibilities.