Skip to main content

Introduction

Tyk Dashboard’s audit log system captures detailed records of all requests made to endpoints under the /api route, providing a record of user activity via Dashboard API or in the UI. The audit logs can be written to local files or to the Control Plane’s persistent storage database, providing flexible options for log management and retrieval. See Enable and View Audit Logs in Tyk Dashboard for a step-by-step guide on using the audit log feature.

Enabling the Audit Log

The audit log is configured within the Tyk Dashboard config file (tyk_analytics.conf) or using the equivalent environment variables.
Please consult Tyk Dashboard Configuration Options for equivalent configuration with environment variables.
Enabling detailed_recording captures the complete HTTP response body from every Dashboard API call. Depending on the endpoint, that response can include sensitive data, such as a newly generated API key, OAuth client secret, or other credentials returned by the call. This data is stored as-is in the audit log, wherever store_type points it. Enable this only when you need it, and make sure the resulting audit log has appropriate access controls.
The legacy setting security.audit_log_path can also be used to enable audit logging. This accepts a file path and combines the functionality of audit.enabled and audit.path. The value configured in audit.path will overrule anything set in security.audit_log_path.

Audit Log Storage

If audit.store_type is set to file, the logs will be added to the file identified using audit.path, in JSON or text format depending on the configuration of audit.format. In text format, each field is written on its own line, in the order listed in the table below.
If hosting Tyk Dashboard within a Kubernetes cluster, please ensure that the configured log file path is valid and writeable.
If audit.store_type is set to db, the logs will be added to a collection or table named audit_records in the Control Plane’s persistent storage, and audit.format is ignored: records are always stored in their native structured form, not as json or text. Database storage has been available since Tyk Dashboard v5.7.0.
Tyk does not manage the size of the audit log file or collection.

Audit Log Content

For each request made to the Tyk Dashboard API’s /api/* endpoints, a log will be generated containing the following data:

Viewing and Retrieving Audit Logs

Tyk Dashboard’s System Management > Audit Logs screen provides a searchable and filterable view of the collected audit logs. The List Audit Logs endpoint, available since Tyk Dashboard v5.7.0, provides access to logs stored in the persistent storage.