Sunday, February 22, 2015

Looking For Trouble:

In my August 2014 post I discussed the UniVerse errlog and how to quickly display the most current entries. Recently while trying to aggregate the types of messages in the error log and having difficulty doing so, a coworker of mine came through with the final OS commands to display an aggregate list of distinct "program error" type entries in the log. Though the script and the results are simple, and not an example of database programming, having a way to collate and display the most prevalent program errors should be of interest to any programmer.

Note: All programming displayed on this site is for illustrative purposes only. Use at your own risk.


cat `cat /.uvhome`/errlog|awk -F"Program" '{ print $2 }'|sort|uniq -c|sort -rn


On a production system configured with a 10,000 line UniVerse error log, running this script has the following example output:


$ strings `cat /.uvhome`/errlog|awk -F"Program" '{ print $2 }'|sort|uniq -c|sort -rn
3454 "INVOICE.POSTING.SUB": Line 259, Variable "ctn" previously undefined. Empty string used.
3454 "INVOICE.POSTING.SUB": Line 261, Variable "per" previously undefined. Empty string used.
1530 "REPORT.DAILY": Line 425, Variable "OTP" previously undefined. Zero used.
600 "REPORT.DAILY": Line 326, Variable "USD" previously undefined. Empty string used.
600 "REPORT.DAILY": Line 303, Variable "OTP" previously undefined. Zero used.
126 "*FIN*GENLIST": Line 4826, Variable "VALUE" previously undefined. Empty string used.
78 "*FIN*GENLIST": Line 4817, Variable "VALUE" previously undefined. Empty string used.
39
24 "INVOICE.PRINT.SUB": Line 749, Variable "seqno" previously undefined. Empty string used.
24 "INVOICE.PRINT.SUB": Line 743, Variable "seqno" previously undefined. Empty string used.
13 "MEMPASS": Line 2043, Array index out of bounds.
10 "MEMPASS": Line 1947, Array index out of bounds.
8 "DISP.FILE.REL": Line 1041, Variable "select.item" previously undefined. Empty string used.



Seventy percent of the errors in the UniVerse error log are from a single program (in this example). Fixing the two errors would alleviate the majority of the log errors, and allow for longer periods of time to be logged (since the file is circular). Similar filtering and sorting could be applied to other program log files (usually in the &COMO& file) as well.

No comments:

Post a Comment