master
1// made by Zuris.
2// the original is reportedly available as `diag.log_analyzer`.
3// this script checks sys.access_log only, in a way that's verifiable - so if you check scripts.get_level on this before running it, you'll know for sure that it doesn't touch your upgrades.
4function(context, args){ // { script }
5 if ((args === null) || (typeof args.script === 'undefined')) {
6 return {ok:false, msg:"Please call this script with {script:#s.sys.access_log} to allow access to your logs"};
7 }
8 var logfile = args.script.call();
9
10 var npc_prefix = ['abndnd', 'uknown', 'unknown', 'derelict', 'anonymous', 'unidentified', 'anon'];
11 var insert;
12 var logs = [];
13
14 logfile.map(function(val, index) {
15 insert = true;
16 for (var i = 0; i < npc_prefix.length; i++) {
17 if (val.indexOf(npc_prefix[i]) > -1) {
18 insert = false;
19 }
20 }
21
22 if (insert) {
23 logs.push(val);
24 }
25 });
26
27 return logs;
28}
29// made by Zuris