You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* **scriptName**: the PHP script name that handled the request
130
302
* **message**: event information message
131
303
* **userAgent**: user agent (if applicable – empty on occ calls)
132
-
* **exception**: Full exception with trace (if applicable)
133
-
* **data** additional structured data (if applicable)
304
+
* **exception**: full exception with trace (if applicable)
305
+
* **data**: additional structured data (if applicable)
134
306
* **version**: Nextcloud version at the time of request
307
+
* **clientReqId**: value of the ``X-Request-Id`` HTTP header sent by the client (only present when the header is set)
308
+
* **occ_command**: the occ command that was executed, as an array of up to two arguments (only present in CLI mode)
309
+
* **backtrace**: full PHP backtrace (only present when ``log.backtrace`` is enabled in config.php)
135
310
136
-
Empty value are written as two dashes: ``--``.
311
+
Empty values are written as two dashes: ``--``.
137
312
138
313
Admin audit log (Optional)
139
314
--------------------------
140
315
141
316
.. _config-admin-audit:
142
317
143
-
By enabling the **admin_audit** app, additional information about various events can be logged. Similar to the normal logging, the audit log can be provided to any of the existing logging mechanisms in :file:`config/config.php`. The default behavior, if no parameters are specified after the app is enabled, is ``file`` based logging to a file called ``audit.log`` stored in the ``datadirectory``.
318
+
By enabling the **admin_audit** app, additional information about various
319
+
events can be logged. The audit log supports all of the logging backends
320
+
described above (file, syslog, systemd, errorlog).
321
+
322
+
Default audit log location
323
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
144
324
145
-
If you wish to override this and log to syslog instead the following would be one approach:
325
+
When using the default ``file`` backend, the audit log is written to
326
+
**audit.log** inside the directory configured by ``datadirectory`` in
The audit log backend can be configured independently from the main
339
+
Nextcloud log using three dedicated keys in :file:`config/config.php`:
340
+
341
+
**log_type_audit**
342
+
The logging backend for audit events. Accepts the same values as
343
+
``log_type``: ``file``, ``syslog``, ``systemd``, or ``errorlog``.
344
+
345
+
Defaults to ``file``.
346
+
347
+
**logfile_audit**
348
+
Path to the audit log file (only used when ``log_type_audit`` is
349
+
``file``). When empty, the default ``audit.log`` in the data directory
350
+
is used.
351
+
352
+
**syslog_tag_audit**
353
+
The syslog identifier for audit messages (only used when
354
+
``log_type_audit`` is ``syslog`` or ``systemd``). Defaults to the value
355
+
of ``syslog_tag``.
356
+
357
+
Example – send audit events to syslog instead of a file:
146
358
147
359
::
148
360
149
-
"log_type_audit" => "syslog",
150
-
"syslog_tag_audit" => "Nextcloud",
151
-
"logfile_audit" => "",
361
+
'log_type_audit' => 'syslog',
362
+
'syslog_tag_audit' => 'Nextcloud',
363
+
'logfile_audit' => '',
152
364
153
365
Log level interaction
154
366
~~~~~~~~~~~~~~~~~~~~~
155
367
156
-
If system ``loglevel`` in ``config.php`` is set to ``2`` or higher, audit logging needs to be triggered explicitly by adding the following setting to ``config.php``:
368
+
The **admin_audit** app writes its messages at **INFO** level (``1``).
369
+
Because the default system ``loglevel`` is **WARN** (``2``), audit messages
370
+
are suppressed unless you explicitly lower the system log level or add a
371
+
conditional override.
372
+
373
+
The recommended approach is to add a ``log.condition`` entry that forces
374
+
DEBUG-level logging for the ``admin_audit`` app context, without affecting
375
+
other apps:
157
376
158
377
::
159
378
160
-
"log.condition" => [
161
-
"apps" => ["admin_audit"],
162
-
],
379
+
'log.condition' => [
380
+
'apps' => ['admin_audit'],
381
+
],
163
382
164
-
Find detailed documentation on auditable events for enterprises in our `customer portal <https://portal.nextcloud.com/article/using-the-audit-log-44.html>`_.
383
+
This ensures audit events are always written regardless of the global
384
+
``loglevel`` setting.
165
385
166
-
Integrating into the Web Interface
167
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
386
+
Integrating into the web interface
387
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168
388
169
-
The built-in NC ``logreader`` app (which is what provides the *Administration settings->Logging* interface) only accesses the file-based ``nextcloud.log``. The **admin_audit** app log output, however, can be integrated into the web interface by configuring it to *also* log to the ``nextcloud.log``.
389
+
The built-in **logreader** app (which provides *Administration settings →
390
+
Logging*) only reads the file-based ``nextcloud.log``. By default the
391
+
audit log is written to a separate ``audit.log`` file, so audit entries
392
+
will not appear in the web interface.
170
393
171
-
Add the following to your ``config.php`` (adjusting the path to your own ``nextcloud.log`` path):
394
+
If you want audit events to appear in the logreader, point
395
+
``logfile_audit`` at the same file as ``nextcloud.log``:
Previously the audit logfile was defined in the app config. This config is still used when the system config is not provided, but is considered a legacy parameter.
406
+
Adjust the path above to match your actual ``datadirectory`` location.
407
+
This merges audit entries into the main log file; the separate
408
+
``audit.log`` will no longer be written.
184
409
185
-
::
410
+
Configuring through admin_audit app settings (legacy)
0 commit comments