Well, I guess I was not too clear but I did mention the users are listed in the red-node settings file. Therefore, the users must login through the standard UI login page.
If you mean logging into the Node-RED editor, you could use the audit log events for that.
The first thing would be to set audit to true on the logging section of the settings file and restart Node-RED
You should then see the audit events in the regular log.
If that gives you the info you need, you could create a custom logger that just collected the audit events and write them wherever you want. Don't have a good link for how to write a custom logger, but can share something tomorrow.
Thanks, I'm getting close to what I'm looking for. In /var/log/syslog I see the following info:
10 Oct 08:51:04 - [audit] {"event":"comms.open","level":98,"timestamp":1633848664512}
10 Oct 08:51:04 - [audit] {"event":"comms.auth","user":{"username":"admin","permissions":"*"},"level":98,"timestamp":1633848664540}
I suppose I can analyze the file with a Python process (at the end of the day) and save the info (username/timestamp) into my DB. Unless you suggest to do it using a flow.
So, if I understood correctly the procedure, I can create my own logger with a function which sends to my DB the username and its timestamp when the user logs in?
Thanks, will look into that. In the mid-time, I trying to undestand why the user 'demo' is not logged in syslog, it only shows 'admin' even though both users have credentials in 'settings.js'