Doc: Difference between audit and changelog

I am starting this topic because I had troubles understanding the dhis2 audit and changelog rationality. I hope that this compilation of information helps other people.


Currently, there are 2 different mechanisms for saving “what users are doing in the system”:

  • Audit is registering almost any change or access to the system and store them in files. The information is stored in files and/or the database, but it is not accesible using the API.
  • Changelog is manually populating some tables, just for some changes (attributes, datavalues and tracked entitites) and offers some API endpoints to retrieve this data.

Even though some data will overlap, this 2 mechanisms are meant for different purposes:

  • Audit is there in case an audit is needed, for example if there someone enter the system without permission it would be possible to check what he did and what he saw. The system does not offer any tool to inspect those data, but the data is there.
  • Changelog is there to store and provide the history of some specific objects.

Naming is not helping, because everything used to be called audit (the file storing and the table storing). dhis2 team is trying to call the first one audit and the second one changelog but this distinction is not clear and it is still in progress.

In dhis2 v40, these db tables contain the string ‘audit’, but actually only the first one (audit) is an audit table. The other tables are changelog tables:

Table name type
audit audit
datavalueaudit changelog
dataapprovalaudit changelog
programtempownershipaudit changelog
trackedentityaudit changelog
trackedentityattributevalueaudit changelog
trackedentityinstanceaudit changelog
trackedentitydatavalueaudit changelog

As a side note, the changelog that appears on Capture is coming from the changelog tables.

image

Another note: audit can be configured for storing the information in files, in a table of a database, in both (files and database) or no storage.

You can find some audit documentation here: Audit - DHIS2 Documentation

You can find the Changelog endpoints documentation here: Audit - DHIS2 Documentation (the fact that this page is still called audit doesn’t help to reduce the confusion)

Thanks to @enrico and @eirikhaugstulen for helping me in that way!

1 Like

Hi @ctejo

Thanks for the helpful post. I’d like to add that there are in depth explanations in this jira ticket and related ones: [DHIS2-16126] - Jira

Thanks!