# Doc: Difference between audit and changelog

**URL:** <https://community.dhis2.org/t/doc-difference-between-audit-and-changelog/60456>\
**Category:** Support - Assistance technique\
**Created:** [13 August 2024 12:30 UTC](https://community.dhis2.org/t/doc-difference-between-audit-and-changelog/60456 "2024-08-13T12:30:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ctejo](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/ctejo/32/42385_2.png) [@ctejo](https://community.dhis2.org/u/ctejo)\
**Post date:** [13 August 2024 12:30 UTC](https://community.dhis2.org/t/doc-difference-between-audit-and-changelog/60456/1 "2024-08-13T12:30:38Z")

</div>

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. The information is stored in files and/or the database (or it is not stored), 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 (until dhis2 version 41) | Table name (from dhis2 version 42) | type |
| --- | --- | --- |
| `audit` | | audit |
| `dataapprovalaudit` | | changelog |
| `datavalueaudit` | | changelog |
| `programtempownershipaudit` | | changelog |
| `trackedentityattributevalueaudit` | `trackedentitychangelog` | changelog |
| `trackedentityaudit` | | changelog |
| `trackedentitydatavalueaudit` | `eventchangelog` | changelog |
| `trackedentityinstanceaudit` | | changelog |

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

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/0/4/04802c8eafbe321889807bab88dcd6d9c55449c4.png)

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/6/5/6528cf43aba999802928aa0c73c0fae26ce514e4.png)

# Audit

**audit** can be configured (in `dhis.conf`) for storing the information in files, in a table of a database, in both (files and database) or no storage using these parameters:

```auto
# Save data in the database. Since v2.38, the default value is 'off'.
audit.database = on / off

# Save data in the files. Since v2.38, the default value is 'on'.
audit.logger = on / off

```

Also in `dhis.conf`, you can configure the level of detail ([scopes](https://docs.dhis2.org/en/manage/concepts/audit.html?h=audit.metadata+manage#audit_scope) and [types](https://docs.dhis2.org/en/manage/concepts/audit.html?h=audit.metadata+manage#audit_type)) to be saved. These are the default values:

```auto
audit.metadata= CREATE;UPDATE;DELETE
audit.tracker = CREATE;UPDATE;DELETE
audit.aggregate = CREATE;UPDATE;DELETE

```

You can find some **audit** documentation here: [Audit - DHIS2 Documentation](https://docs.dhis2.org/en/manage/concepts/audit.html)

# Changelog

In **changelog** , each “change” (a row saved in a database table) has a `type`. The valid values for the `type`are `CREATED`, `UPDATED` and `DELETED` (previous to version 41, the type `READ` could appear in the changelog. From version 42, the Flyway script will take care of removing the `READ` entries in the changelog tables).

In `dhis.conf` file, you can configure if you want to save the changelog for aggregate and tracker (you cannot select the `types` to be saved):

```auto
# Aggregate changelog, can be 'on', 'off'. Default: 'on'
changelog.aggregate = on

# Tracker changelog, can be 'on', 'off'. Default: 'on'
changelog.tracker = on

```

**Note** : At least in version 40.7, if the parameter “Enable tracked entity instance audit log” is NOT checked in the Tracked Entity Type, the changes are not saved in the database (table `trackedentityattributevalueaudit`).

You can find the **changelog** endpoints documentation here: [API for audit](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/audit.html) (the fact that this page is still called audit doesn’t help to reduce the confusion) and here: [Logging - DHIS2 Documentation](https://docs.dhis2.org/en/manage/reference/logging.html#install_changelog) (this link is in process of review).

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

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [15 August 2024 14:39 UTC](https://community.dhis2.org/t/doc-difference-between-audit-and-changelog/60456/2 "2024-08-15T14:39:59Z")

</div>

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](https://dhis2.atlassian.net/browse/DHIS2-16126)

Thanks!
