Script needed to send log data by HTTP POST (or GET)

Hi

I would like my Mikrotik router to send a HTTP POST/GET to a local webserver every time a “caps,info” event occurs…

I would like to send the date time and log message, like…
10:09:13 caps,info 61:77:BA:6E:B3:F3@cap116 connected
10:10:30 caps,info 61:77:BA:6E:B3:F3@cap116 disconnected, received disassoc: sending station leaving (8)

Does anyone have a script like this, or one that I could adapt?

Thanks

Hi

You could adapt my gps-to-url script to do this. It’s on GitHub:- https://github.com/timmay2/mikrotik-gps/

Rgds,
Tim

In addition to the URL code from Tim’s script, you will also need a script that monitors the logs and keeps track of new and old entries. The following script was created for that purpose, except it checks for strings within the log message. It could easily be adapted to check for topics instead.
http://wiki.mikrotik.com/wiki/Monitor_logs,_send_email_alert_/_run_script

Follow the instructions in the article to configure the schedule and script, with these modifications:

In the setup part of the script at the top, change the last two options to:

:local startBuf [:toarray [/log find topics=caps,info]]
:local removeThese

And, then at the bottom of the script, replace the line

/tool email...

with

The desired URL code...
...
/tool fetch url=...

…and that gets it basically working.

Thanks guys - thats a great help.

I will post my script up here when (if!?) I get it working.

Many thanks