Accessing Jira Audit Information through the Database
Summary
In certain cases, it may be necessary to access Jira's audit log through direct database queries. This article gives an overview of how to do so.
All content in this article was generated with a PostgreSQL database connected to Jira v8.20.2. Any queries may need to be modified to suit different database types and/or Jira versions.
Please note that the audit table has been moved to AO_C77861_AUDIT_ENTITY from Jira v8.8 and onward. Prior to Jira 8.8, the audit table was audit_log.
Also, do note, from Jira 8.8.0, audit log entries can be exported to a CSV file. Refer to Auditing in Jira for more information.
Where is this information stored in the database?
Jira stores its audit information in the audit_log table.
The following SQL query lists which events are individually recorded:
SELECT distinct("ACTION") FROM public."AO_C77861_AUDIT_ENTITY"
Output:
These individual events are broken up into categories (the CATEGORY column), which may be useful for a broader view of events:
How do I query for the information I need?
The audit_log table contains several columns with information that varies depending on the audit event (ACTION) and may require exploration to understand which columns should be included in the query. Knowing the possible entries for the ACTION and CATEGORY columns allows for the formation of exploratory queries:
SELECT * FROM public."AO_C77861_AUDIT_ENTITY" WHERE "ACTION"='Project created' LIMIT 5;
SELECT * FROM public."AO_C77861_AUDIT_ENTITY" WHERE "CATEGORY"='projects' LIMIT 5;
In reviewing the results of these queries, the SELECT statement can be modified to isolate the information needed.
Example