Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to fetch CMDB audit logs via Table API - which tables to query?

gurwindersi
Tera Contributor

I need to retrieve CMDB-related logs programmatically using the Table API.
I'm looking for guidance on:

  1. Which tables contain CMDB audit/change logs?
  2. What's the correct API endpoint structure?
1 REPLY 1

mmanneru
Tera Contributor

To retrieve CMDB-related logs programmatically using the ServiceNow Table API, you're essentially looking to query the tables that store audit and change history for CMDB records.

Table Names:

Sys_audit

sys_history_line

sys_history_set

cmdb_ci

Note: Audit must be enabled for the relevant CMDB tables/fields to populate sys_audit.

To retrieve all changes made to CMDB records in the last 7 days:

GET /api/now/table/sys_audit?sysparm_query=document_table=cmdb_ci^sys_created_on>=javascript:gs.daysAgoStart(7)