Is there any way to make the logfile more readable?

This is handy, thanks! I made a custom format for the default server log:

{
  "nextcloud_log": {
    "title": "Nextcloud log",
    "description": "Nextcloud JSON server log",
    "url": "https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/logging_configuration.html?highlight=logging#log-field-breakdown",
    "json": true,
    "file-pattern": "nextcloud.log$",
    "opid-field": "reqId",
    "level-field": "level",
    "body-field": "message",
    "hide-extra": true,
    "level" : {
      "debug" : "0",
      "info": "1",
      "warning" : "2",
      "error" : "3",
      "fatal" : "4"
    },
    "timestamp-field": "time",
    "convert-to-local-time": true,
    "multiline": false,
    "value": {
      "exception": {
        "kind": "json"
      },
      "app": {
        "kind": "string",
        "identifier": true
      }
    },
    "line-format": [
      {
        "field": "__timestamp__",
        "timestamp-format": "%b %e %H:%M:%S"
      },
      " ",
      {
        "field": "__level__",
        "text-transform": "uppercase"
      },
      " ",
      {
        "field": "app"
      },
      " ",
      {
        "field": "message"
      }
    ]
  }
}

If you save that to a local file named nextcloud.json you can install it with lnav -i nextcloud.json. Even better, commit it to source control, then pass the repo link to lnav -i.

Update 2023-04-11: here’s a better one. It handles all Nextcloud server logs, and tracks “operation id” so you can use o and O to navigate between log lines caused by the same request.

1 Like