Audit
Use the Harness CLI to read the audit trail, filter audit events, and inspect change diffs.
Use the Harness CLI to read the audit trail, filter audit events by date, resource type, action, and principal, and inspect the YAML diff of a change.
The Harness audit trail records every create, update, and delete across every Harness module. The CLI gives you read-only access to that trail, so you can answer who changed what and when from your terminal or from a script, and inspect the exact YAML diff of a change.
This page covers all Audit resources and actions available in the CLI.
What you will learn in this topic
By the end of this page, you will know how to:
List audit events and understand the default time window.
Filter events by date range, resource type, action, and principal.
Retrieve a single event with the YAML diff of the change.
Before you begin
Harness CLI installed and authenticated: Go to Install and upgrade and Authenticate for setup steps.
Audit view permissions: Reading the audit trail requires view access on the audit trail at the scope you query. Go to Audit trail for the permission model.
Audit events
An audit event is one recorded change to one resource. Every create, update, and delete in Harness produces an event, and the audit trail is read-only: you can query events but never modify them.
List audit events
By default the command returns events from the last seven days.
Filter audit events
Narrow the trail with these flags:
--from: Start of the time window.--to: End of the time window.--resource-type: Restricts results to one resource type.--action: Restricts results to one action, such as a create or a delete.--principal: Restricts results to changes made by one user or service account.
Get an audit event
Retrieve a single event. The response includes the YAML diff of the change, so you can see the before and after state of the resource.
Troubleshooting
No events returned for the expected time window: The
list audit_eventcommand defaults to the last seven days, since that is the default time window. Pass--fromand--toto widen the range.Permission denied when querying the audit trail: Confirm the principal has view access on the audit trail at the scope you query, since audit view permissions are scope-specific.
A YAML diff is missing from a
get audit_eventresponse: Not every action type captures a full before and after state, since some resource types do not support YAML diffs.
Related concepts
Governance: Manage the OPA policies that gate the changes the audit trail records.
Audit trail: Understand the full audit model and streaming options.
Platform: Manage account resources, connectors, and secrets.
Last updated
Was this helpful?