1.12 Metadata audit

If you need information about who created, edited, or deleted DHIS2 metadata objects you can enable metadata audit. There are two configuration options (dhis.conf) you can enable to support this:

metadata.audit.log = on

This enables additional log output in your servlet container (e.g. tomcat catalina.log) which contains full information about the object created, object edited, or object deleted including full JSON payload, date of audit event, and the user who did the action.

metadata.audit.persist = on

This enables persisted audits, i.e. audits saved to the database. The information stored is the same as with audit log; however this information is now placed into the metadataaudit table in the database.

We do not recommended enabling these options on a empty database if you intend to bootstrap your system, as it slows down the import and the audit might not be that useful.

1.12.1 Metadata audit query

If you have enabled persisted metadata audits on your DHIS2 instance, you can access metadata audits at the following endpoint:

/api/29/metadataAudits

The endpoints supports the following query parameters:

Metadata audit API query parameters
Name Values Description
uid Object uid to query by (can be more than one)
code Object code to query by (can be more than one)
klass Object class to query by (can be more than one), please note that the full java package name is required here (to avoid name collisions)
createdAt Query by creation date
createdBy Query by who made the change (username)
type CREATE, UPDATE, DELETE Query by audit type