sys_audit table is too big ( need a way to clean that using script )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 01:10 PM
1. Can some one help me how to know which table is have more audits ? by year by year ?,, ( I tried using report ,its timing out as our audit history is too big ) , can we do it with background script ?
Tried this but its not giving any results
var gr= new GlideRecord("sys_audit");
gr.addEncodedQuery("sys_created_onON2013-07-28@javascript:gs.dateGenerate('2013-07-28','start')@javascript:gs.dateGenerate('2016-07-28','end')");
gr.query();
gs.print(gr.getRowCount());
and 2. fix script to delete the records which are older than july 4 2015
delCoreCompanyRec();
function delCoreCompanyRec()
{
var gr= new GlideRecord("sys_audit");
gr.addEncodedQuery("sys_created_onON2016-07-28@javascript:gs.dateGenerate('2016-07-28','start')@javascript:gs.dateGenerate('2016-07-28','end')");
gr.setWorkflow(false); //Don't fire Business rule,notifications
gr.deleteMultiple();
}
and 3.a schedule job script to delete records which are older than 3 years
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 01:20 PM
take a look at archive rules
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 01:30 PM
I cannot find SYsaudit file in that 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 01:39 PM
I was able to find it in my instance though.
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 01:49 PM