What data does sys_history_line, sys_history_set and sys_audit table exactly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2018 12:21 AM
Hi,
Any pointers on what data does the following tables contain.
1.sys_history_line
2.sys_history_set
3.sys_audit
I understand all these table tracks the changes performed in the instance.
However, exact purpose of above tables would be more useful.
Thanks,
Balaji
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2018 12:28 AM
HI Balaji,
Best explanation by service now:
https://docs.servicenow.com/bundle/london-platform-administration/page/administer/security/concept/c_DiffBtwnAuditHistSets.html
1) Sys_audit: This table tracks changes or insert on the tables where audit check box on dictionary record is true. It will not audit system table by default. If you want you have to make them auditable. If you have one field for which you want to stop auditing you can use no_audit attribute as well.
2) The History [sys_history_line] table stores the actual changes to field values that occurred.
3) The History Set [sys_history_set] table identifies which particular records from an audited table have historical information.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2018 12:30 AM
Hi,
One important thing i need to say is: sys_audit stores data permanently and other two tables holds most recent changes to the records or tables.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2024 02:34 AM
DO you know if there is any contraint in terms of time? How old data are stored there?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2018 12:30 AM
Hello,
Enabling auditing on a table tracks the creation, update, and deletion of all records in 2 different tables ie sys_audit and sys_history_set table. The main difference is the way in which data is stored and managed between these 2 tables. sys_history_line is related to the history set and actually stores the audited entries for a record.
Here are links for further reference which explains its difference and usages
https://docs.servicenow.com/bundle/london-platform-administration/page/administer/time/concept/audited-tables-2.html
https://docs.servicenow.com/bundle/london-platform-administration/page/administer/security/concept/c_HistorySets.html