All Articles

How to create an audit log for Notion database properties

This requires a paid Notion account as it uses database automations.

Creating an audit log

alt text

Notion has an Updates & analytics panel for each page, but it can get cluttered showing all changes, including all content changes.

If you’d like a simpler audit log that shows only changes to database properties you care about, you can do this with database automations and a second database.

Limitation: This will only log changes made by users, not those made by automations. Currently in Notion, automations can not trigger other automations.

You can watch this video walkthrough, or follow the steps below.

https://youtu.be/2DzuUOlzk4E

Example: Tracking assignee changes for tasks

In our example, we’ll use a tasks database called My Tasks and track all changes to the Assignee property.

These changes will be visible when viewing the task’s page.

Step 1: Create the log database

  1. Create a new database called My Tasks Log with properties

    • “My Task” (Relation)
      • Make it a two-way relation with the related property name “Log”.
    • “Created time”.
    • “Timestamp” (Formula)
  2. For Timestamp, use a formula for a more readable time, like this one:

    ifs(
      dateBetween(now(), prop("Created Time"), "hours") < 1,
      format(dateBetween(now(), prop("Created Time"), "minutes")) + "m ago",
      dateBetween(now(), prop("Created Time"), "hours") < 24,
      formatDate(prop("Created Time"), "h:mma"),
      formatDate(prop("Created Time"), "MMM D")
    )

    This will display the created time more concisely, showing how long ago it was for times under 1 day ago.

The database should look like this:

alt text

Step 2: Create the automations

  1. Create an automation in the My Tasks database.

  2. Name it Log initial assignee.

  3. Add the trigger: Page added

  4. Add the action: Add page to the My Tasks Log database.

  5. Set the following property values:

    • Set My Task to Trigger page

    • Set Name to a formula value that displays what changed, e.g.:

      if(
        empty(TriggerPage.prop("Assignee")),
        "Assignee initially empty",
        "Assignee set: " + TriggerPage.prop("Assignee").map(name(current))
      )

      You’ll need to delete “TriggerPage” in the above formula, start typing it, and select it from the menu below. You’ll now it’s working when it has a grey background.

      This formula will log “Assignee initially empty” if the task was created with no assignee, or the assignee’s name if there is one.

  6. Save the automation.

  7. Duplicate the automation and open it. Both automations will have the same name and settings, so you can open either one.

  8. Rename the automation to “Log updated assignee”.

  9. Delete the current trigger and add: Property > Assignee > Assignee is edited.

    • Tip: Make sure to press Done when setting the trigger, or it won’t save.
  10. Edit the formula that sets the Name property so the third line instead says “Assignee cleared”. E.g.:

    if(
      empty(TriggerPage.prop("Assignee")),
      "Assignee cleared",
      "Assignee set: " + TriggerPage.prop("Assignee").map(name(current))
    )

    You’ll need to delete “TriggerPage” in the above formula, start typing it, and select it from the menu below. When it has a grey background, you know it’s working.

  11. Create a test task, add an assignee and then remove it. Your My Tasks Log database should look like this:

    alt text

Step 3: Show the audit log in tasks

  1. Let’s customize the layout of tasks so the audit log is clearly visible.

  2. Open the test task you just created.

  3. Select Customize layout above the page title. alt text

  4. Select Add to panel.

  5. Choose the Log property.

  6. Press the Apply to all pages button.

  7. Press the View details button under the title. alt text

  8. Hover over the Log section and select •••. alt text

  9. Press the eye button next to the Timestamp property. alt text

  10. Make some changes to the assignee and watch them appear in the panel!

Note: If you make two changes very quickly, it’s possible that the first has the same data as the second. This is due to how Notion’s automations work. In practice, this shouldn’t omit important information.

You’re done

You can repeat this process for any number of database properties.

If you want a filterable view of the logs for a task, open the My Tasks Log database, filter for that task, and sort by Created time.

If you log multiple properties, you can view the logs for only one by searching for it. E.g. searching assignee will show only assignee changes.

Published Jan 7, 2025

Happy to hear from you at matt@matt.fyi or @mattjustfyi on X.