User Sessions > Log to Events

Started by Spheron, January 15, 2026, 11:33:16 AM

Previous topic - Next topic

Spheron


Hello @all,

is it possible to log the user sessions (User, Client name, Client Adress, ...) to the NetXMS event log?

Greetings
Marco

Filipp Sudanov

We have this information in Audit log, but if you need it in Event Log - there's Hook::login script in script library that you can use for that. Make sure that this script returns true, otherwise it will prevent users from logging in.

To see what attributes are available in this script you can try this - it will log details to server log:

for (a : $user.__class.attributes) trace(0, "$user." .. a .. " = " .. $user.__get(a));
for (a : $session.__class.attributes) trace(0, "$session." .. a .. " = " .. $session.__get(a));
return true;

Then you can use PostEvent() or PostEventEx() to create the event (https://netxms.org/documentation/nxsl-latest/#func-postevent), drop us a line if you need more help with scripting.