You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Create syslog_script.js
Fix script to identify TOP 'N' number of records by 'Source' name in any specific duration to optimize and maintain log table health
* Create readme.md
This file will detail you the fix script
/* Create a GlideAggregate on the Syslog table to identify the Top 10 contributors by 'Source name' and 'Number of occurrences on 'Daily' or'any specific interval'.
2
+
3
+
This could be vital to maintain the instance performance by regualar optimizing the Syslog table by identifying the top contributors. Based on this syslog table
4
+
Could it be reviewed by owners to make the correct decisions on whether logging is required for these tables?
5
+
6
+
*/
7
+
8
+
topN('syslog','source',10);//Create a function to identify top 'N' number of records by source. Eg. 10
9
+
10
+
functiontopN(pTable,pColumn,pCount){
11
+
varga=newGlideAggregate(pTable);// query on table required
12
+
ga.addAggregate('COUNT',pColumn);// Count the number of records by source to record how many times it generated log
13
+
ga.orderByAggregate('COUNT',pColumn);
14
+
ga.addEncodedQuery('sys_created_onONLast 15 minutes@javascript:gs.beginningOfLast15Minutes()@javascript:gs.endOfLast15Minutes()');//query for last 15min data
15
+
ga.query();
16
+
vari=0;
17
+
varstdout=[];
18
+
stdout.push('\nTop '+pCount+' '+pColumn+' values from '+pTable+'\n');
0 commit comments