That does already exist as well. It is the
admin_audit app, that logs (beside other activities) all logins and logouts on the server.
You must activate the
admin_audit app, by entering this to your config.php:
'logfile_audit' => '/var/log/nextcloud/audit.log',
0 => 'admin_audit',
/var/log/nextcloud should of course be created first:
mkdir -p /var/log/nextcloud && chown www-data.www-data /var/log/nextcloud
then you can monitor all login- and logouts live, with this jq-filter:
tail -F /var/log/nextcloud/audit.log | jq -r 'select(.message | test("Login successful|Logout occurred")) | [.time, .remoteAddr, .user, .method, .url, .message, .userAgent] | join(" - ")'
The actions you can see with the
nc-who app, are all coming from the nextcloud database. The ip-adresses are not loged to the database, so if you want to “count” them, it is needed to perform some more analizing on this logfile.
When you monitor this login and logout for a while, you get deeper insights, how often a login occurs and for what reasons. That can be a simple synch job for an android client or so.
After you have studied this more in deep, you can decide better, what you think is possible or what you exactly want.