How to check status of Background Scripts

Rakesh16i
Kilo Expert

Hi,

I am trying a Background Script to delete "Next hop Routing rule" CIs from CMDB using the following script. It has ran for quite a large time as it needs to delete nearly 400 million Cis. However after 2 days when I re checked only 200 Million CIs got deleted and I am not sure what happened in between. I wantedto know how can I check logs of background scripts to determine the cause.

doit("dscy_route_next_hop");

function doit(table) {

  var gr = new GlideRecord(table);

  gr.query();

  gr.deleteMultiple();

}

Regards,

Rakesh Imandi

3 REPLIES 3

mrswann
Kilo Guru

400 million woah



I'd break that one down -   you can include some logging , but at that volume it's going to slow down and clog the logs



you can see from system logs what script was executed , I don't know how much more detail you will get




can you not just empty the table?


levin
ServiceNow Employee
ServiceNow Employee

Yes, I would agree with mrswann.


It is pure code thing. You can print a message when finishing 100K or 1m records.


The log will only show up some necessary message in terms of troubleshooting purpose, and won't give us the progress.


Vini
Giga Guru

Hi @Rakesh16i ,

 

We can use  Table Cleaner (Auto Flush) option to delete bulk records in CMDB. we dont need any coding for it.

these tables are populate CI's on every discovery schedules so I have created Auto Flush on this table.

 

https://docs.servicenow.com/bundle/tokyo-platform-administration/page/administer/managing-data/conce...

 

Note# this is quite old post but my response would help for someone to delete bulk records from any CMDB table.

 

Regards,

Vinil.