Display the current window of activity in the UniVerse errlog:
As delivered, the standard UniVerse error log (errlog in the UniVerse home directory) is configured to rotate through the last 100 errors. The file is "circular", meaning that, after updating line 100 the next error will overwrite line number one (well, line number two, since line one contains the current line pointer). For a stable system with few users a 100 line error log is probably sufficient to hold a couple of days (if not weeks) worth of error messages. However, there may be times when errors are being thrown at a higher rate (or the rate in which the error log is checked is low) which could mean errors will not be seen by anyone before being overwritten. A newly installed system, or a significant DBMS or applications upgrade would warrant a larger error log.
One solution is to increase the number of lines in the file to 200, or 10,000 for example. This is accomplished by modifying the MAXERRLOGENT parameter in the uvconfig file:
$ grep -i err /usr/uv/uvconfig
# MAXERRLOGENT - Specifies the number of logged entries in
# the errlog file. The default setting is 100.
MAXERRLOGENT 10000
In this example it is set to 10,000 lines. While this will help retain very old messages (or a rapid rate of errors) it does not make for an easy time when trying to find the most current error message. One would have to edit the file and navigate to the nth line (where n is the pointer in line one).
Another solution is to write a script to show the last few messages, and continue to show messages as they appear (much like "tail -f" on a growing file). What follows is my approach to writing a script to display the most recent block of error messages.
Note: All programming displayed on this site is for illustrative purposes only. Use at your own risk.
#! /bin/sh
uvhome=`cat /.uvhome`
prevcnt=`head -1 $uvhome/errlog`
prevcnt=`expr $prevcnt - 20`
while true; do
currcnt=`head -1 $uvhome/errlog`
diffcnt=`expr $currcnt - $prevcnt`
if [ "$diffcnt" -ge 1 ]; then
cat $uvhome/errlog | tr -d '\000' | head -$currcnt | tail -$diffcnt
fi
sleep 10
prevcnt=$currcnt
done
This script works as-is on Solaris and Redhat Linux. The errlog file is a data file on Redhat Linux:
$ file /uvdata/ibm/uv/errlog
/uvdata/ibm/uv/errlog: data
However it is a text file on Solaris, HP-UX, and AIX:
$ file /uvdata/uv/errlog
/uvdata/uv/errlog: ascii text
This is the reason why nulls are translated out of the stdin stream. Using "strings" instead of "cat" would probably work as well.
No comments:
Post a Comment