Nextcloud Client - See Version used by all users

Hey there!

I am looking for a way, to easily see the version of the client used by a Nextcloud User or if possible even force them to update the client or send them a message via Nextcloud.
The machines of the users are not managed by a central IT (Own devices at a charity project).
I saw, that the version is sent by the client and could be read in the logs, but the analysis would take very long :frowning:

If you know a simple solution please get in touch!

All the best,
Christoph

I would say this is the way: check logs and find out Client versions.

BUT! You can force users to update clients via configuration only in config.php:

'minimum.supported.desktop.version' => '2.0.0',
3 Likes

if you have admin_audit enabled maybe the easiest way would be to extract the list of users and their clients from the audit.log.

This file hold user actions and is JSON formatted. the example below shows initial unauthenticated request (user is β€œβ€“β€), once the user successfully login user field becomes populated…

{
  "reqId": "asSZfp8wE6FgWnSZn5Xq",
  "level": 1,
  "time": "2022-08-10T11:35:00+00:00",
  "remoteAddr": "192.168.11.204",
  "user": "--",
  "app": "admin_audit",
  "method": "GET",
  "url": "/ocs/v2.php/cloud/capabilities",
  "message": "Login attempt: \"mytestuser\"",
  "userAgent": "Mozilla/5.0 (Android) Nextcloud-Talk v14.1.0",
  "version": "24.0.3.2",
  "data": {
    "app": "admin_audit"
  }
}

in your case interesting fields would be user and userAgent. you can process this file with jq command and filter and extract this attributes:

cat audit.log|jq '{user: .user, userAgent: .userAgent}'|jq --slurp 'unique_by(.user, .userAgent)'

Explanation:

  • cat audit.log|
    first output the content of the audit.log and pipe it to jq
  • |jq '{user: .user, userAgent: .userAgent}'
    using jq only process user and userAgent from each log line (and create new JSON string with this data)
  • |jq --slurp 'unique_by(.user, .userAgent)'
    use another jq instance to build unique list

Depending on your goal you may filter by specific userAgent (mirall is desktop client):

cat audit.log | jq 'select(.userAgent |test("mirall")) | {user: .user, userAgent: .userAgent}' | jq --slurp 'unique_by(.user, .userAgent)'

or specific user:

cat audit.log | jq 'select(.user |test("mytestuser")) | {user: .user, userAgent: .userAgent}' | jq --slurp 'unique_by(.user, .userAgent)'

if you want you can export this as csv as well

cat audit.log|jq 'select(.userAgent |test("mirall")) | {user: .user, userAgent: .userAgent}'|jq --slurp 'unique_by(.user, .userAgent)|.[] |flatten|@csv'

hope this helps you further. Definitely it is possible to collect the data from nermal nextcloud.log as well but it is definitely harder as this logs hold much more (diferent) information so it’s harder to extract useful data there.

1 Like