Run script when client is disconnected from my Hotspot

First of all - Hi for all. It is my first post here.

I need to monitor somehow when clients leave my hotspot.
For instance:

  • i give a trial internet via my hotspot for a 1 hour
  • client connect to hotspot, log-in via Trial link
  • and surf in the internet, say, 20 minutes, then just go away, or disable the Wi-Fi on his device
  • in the moment of disconnection (maybe when client disappears from registered by my Wlan ) i need to rung some script.
    Hence i need to find out a way of how to check the disconnection moment.

Hope someone may help me. If i have described my goal not so clear, please say that, i will rephrase it.
Thank you mikrotick community in advance!

I’m afraid this is not possible with routerOS onboard tools.
You could either schedule a script which parses the log every n minutes - or you add logging wireless events to a syslog server and parse there.

-Chris

Thank you for such fast answer.

Some tips of how to parse logs(??)

May i do it on board or needs to sent them into external server for parsing …

Edit:
Second reading of your replay, makes me a bit clearer))

Going to write about results soon…

You can go for it in the router, this wiki article is pretty nice for the start.
-Chris

Wow, nice, At first look, it is what i need…

So i have followed the article. I have:

  • created buffer in memory,
  • added a topics=wireless,info ,
  • created Log Parser Script (identical as in the wiki)
  • created Parser Action Script (there i have removed almost all if construction and edit one “:if ([:tostr $logTopics] = “wireless;info”) do={ …”)
    Tried to edit second script plenty of times, and still can’t reach the “do={…” construction.

I have went further and checked the:
:global logParseVar
:local logTime [:pick [:toarray $logParseVar] 0]
:local logTopics [:pick [:toarray $logParseVar] 1]
:local logMessage [:pick [:toarray $logParseVar] 2]

As it turned out, the :global logParseVar contains only:
jul/26/2017 ,

But why :local logTopics [:pick [:toarray $logParseVar] 1] and :local logMessage [:pick [:toarray $logParseVar] 2] are empty??
Maybe someone may help with this as well?

Also why time in the jul/26/2017 format and not in the 16:16:22 as it is in the console??

I’d suggest to open a separate post in the scripting forum - this would give you a better chance of being helped.
-Chris

Thank you, going to do so.