# Table level auditing feature

**URL:** <https://community.cratedb.com/t/table-level-auditing-feature/825>\
**Category:** CrateDB\
**Created:** [September 27, 2021, 9:14am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825 "2021-09-27T09:14:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghavendra\_Hegde](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/raghavendra_hegde/32/400_2.png) [@Raghavendra\_Hegde](https://community.cratedb.com/u/Raghavendra_Hegde)\
**Post date:** [September 27, 2021, 9:14am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825/1 "2021-09-27T09:14:15Z")

</div>

Hi All,

I would like to audit DQL and DML operations on few tables.

Is there a feature to capture audit logs in Crate or any third party plugins available?

Thanks,  
Raghu

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [September 27, 2021, 9:28am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825/2 "2021-09-27T09:28:13Z")

</div>

Generally that information would be able in the `sys.jobs_log` table, and one could periodically run a `INSERT INTO <persistence_table> SELECT * FROM sys.jobs_log`. However there is also the option to persistently log queries in the application log (and set a filter for that)

see [System information — CrateDB: Reference](https://crate.io/docs/crate/reference/en/4.6/admin/system-information.html#jobs-operations-and-logs)  
and [Cluster-wide settings — CrateDB: Reference](https://crate.io/docs/crate/reference/en/4.6/config/cluster.html#stats-jobs-log-persistent-filter)

Does this help you?

---

<div class="post-metadata">

**Author:** ![jayeff](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/jayeff/32/271_2.png) [@jayeff](https://community.cratedb.com/u/jayeff)\
**Post date:** [September 27, 2021, 9:33am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825/3 "2021-09-27T09:33:49Z")

</div>

Please note that you will only see the queries for the logged in user when checking `sys.jobs_log`.

Logging the queries or querying `sys.jobs_log` with the superuser `crate` will include queries by all users.

---

<div class="post-metadata">

**Author:** ![Raghavendra\_Hegde](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/raghavendra_hegde/32/400_2.png) [@Raghavendra\_Hegde](https://community.cratedb.com/u/Raghavendra_Hegde)\
**Post date:** [September 27, 2021, 10:01am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825/4 "2021-09-27T10:01:37Z")

</div>

Ok, thanks. This is what I was looking for.

One more question:

Is there way to disable these logging? It may create performance issues by logging on all users and tables.

can I enable only for specific users or tables?

Thanks,  
Raghu

---

<div class="post-metadata">

**Author:** ![jayeff](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/jayeff/32/271_2.png) [@jayeff](https://community.cratedb.com/u/jayeff)\
**Post date:** [September 27, 2021, 10:13am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825/5 "2021-09-27T10:13:32Z")

</div>

> Is there way to disable these logging?

No need, as the default for persisting queries to the logs is disabled (compare documentation for [`stats.jobs_log_persistent_filter`](https://crate.io/docs/crate/reference/en/4.6/config/cluster.html#stats-jobs-log-persistent-filter))

> can I enable only for specific users or tables?

Yes, as documented by setting a filter for `stats.jobs_log_persistent_filter`. See [`stats.jobs_log_filter`](https://crate.io/docs/crate/reference/en/4.6/config/cluster.html#stats-jobs-log-filter) for an example how to do this.

You can set a filter like `username = <user>` and / or `stmt ILIKE '%from <tablename>%'`

---

<div class="post-metadata">

**Author:** ![Raghavendra\_Hegde](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/raghavendra_hegde/32/400_2.png) [@Raghavendra\_Hegde](https://community.cratedb.com/u/Raghavendra_Hegde)\
**Post date:** [September 27, 2021, 11:25am UTC](https://community.cratedb.com/t/table-level-auditing-feature/825/6 "2021-09-27T11:25:37Z")

</div>

Ok, Thanks for information and support.
