# Database audit trailing

To enable audit logs for databases you need to create a new table for auditing and then enable audit logs option at the extension level.

### Create a new table for auditing

Before using audit logs, you need to create a new table in your database to store the logs. The structure of this table must be the same as the writeback table with 3 additional columns: ActionAt, ActionBy and ActionType.

| Column         | Type     | Description                                                      |
| -------------- | -------- | ---------------------------------------------------------------- |
| **ActionAt**   | datetime | Date and time when the action was performed                      |
| **ActionBy**   | string   | Which user performed the action (UserDirectory\UserId)           |
| **ActionType** | string   | What action was performed  ( C = create, U = update, D= delete ) |

### Enable audit logs in the extension

1\. Open the properties panel and click on the Data Connections section

<div align="left"><img src="/files/-MYtQCKCjuOeqcLi0mqS" alt=""></div>

{% hint style="warning" %}
You need to set up a connection before enabling logs
{% endhint %}

2\. Go to the *Enable audit logs* option

<div align="left"><img src="/files/-MYwVVG21hLIrFSefVR4" alt=""></div>

3\. Click on the switch control to enable audit logs

<div align="left"><img src="/files/-MYwVhTZjFnawaRDIk-t" alt=""></div>

4\. Enter the name of the log table (e.g. Customers\_log)

<div align="left"><img src="/files/-MZCn_t3gz8cCmPp0pWF" alt=""></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.qommentary.com/qommentary-writeback/advanced/audit-trails/enable-audit-trails-for-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
