run script after hotspot "logged out: keepalive timeout"

Hi, is there any way to run a user-defined script after the user has been automatically logged out of the hotspot portal because of the keepalive timeout ran out?

Is there any way to actually notify external command that the user is not in the hotspot registration table any more?

Thank you.
Marcel

In ‘/ip hotspot user profile’ you can set ‘on-login’ and ‘on-logout’ script, but I’m not sure if you can get username which logged in or out.

mrz, thank you for your answer, however your solution does not solve my problem, since the script which is called after user logs-out is, not the one which is run after the users session expires - well, to be more precise, there is no way to specify expiration script to run

any other ideas on how to notify external systems that the users session has expired?

Make a syslog target that at minimum subscribes to “hotspot,account” as that gets notified on logout for any reason. Below a sample record with just the external router IP filtered out:

Aug 10 13:55:36 <ip>/<ip> hotspot,account testaccount (192.168.0.18): 121 1286 13674 15 17 (keepalive timeout)

You can either log to internal and use the wiki samples to construct a script that can act on these, or you can log to external and use any number of tools to parse the incoming records and take action.

Hope that helps,
Felix

That is a brilliant idea! Thank you for a great tip!
Marcel