• Antelope Release 5.5 Mac OS X 10.8.5 2015-04-21

 

NAME

logs2dlevent - parse logs files for particular phrases and add to a db table

SYNOPSIS

logs2dlevent [-p pf] [-d 'time' ] [-n ndays] [-v] [-l match_logname] logdir db

SUPPORT


Contributed code: NO BRTT support.
THIS PIECE OF SOFTWARE WAS CONTRIBUTED BY THE ANTELOPE USER COMMUNITY. BRTT DISCLAIMS ALL OWNERSHIP, LIABILITY, AND SUPPORT FOR THIS PIECE OF SOFTWARE.

FOR HELP WITH THIS PIECE OF SOFTWARE, PLEASE CONTACT THE CONTRIBUTING AUTHOR.

DESCRIPTION

logs2dlevent examines logs written to disk with orb2logs(1) to find rows which match a regular expression. The simple match (and reject) expressions are kept in a parameter file, logs2dlevent.pf. The matching lines are placed as a dlcomment into a dlevent table and tagged with a dlevtype. The program dlreport(1) can be run to summarize the events.

OPTIONS

FILES

Input files to be read are assumed to look like the output from orb2logs.

PARAMETER FILE

This is an example parameter file:


#
# logs2dlevent.pf
#

match &Tbl{
UMSG
recenter
massrecenter
masslock
massunlock
getconfig
getannc
getstatus
reboot
}

reject &Tbl{
#Processing
sbpwr
Baler
dopen
QMASERV
C1_UMSG
Error
Sending
Issuing
}

dlevents &Arr{
#	dlevtype	log_phrase
	service		UMSG
	massrecenter	recenter
	massrecenter	massrecenter
	sensor_lock	masslock
	sensor_unlock	massunlock
	sensor_cal   	calibration
	request_config	getconfig
	request_annc	getannc
	request_status	getstatus
	baler		Baler
	reboot		reboot
}

convert_umsg &Arr{
# UMSG_comment_phrase	dlevtype
        massrecenter    massrecenter
        recenter        massrecenter
        center          massrecenter
        MRC             massrecenter
        mrc             massrecenter
        unlock          sensor_unlock
        lock            sensor_lock
        Cal             sensor_cal
}

Which log strings are kept are controlled by:

How the strings are mapped to dlevtypes is controlled by:

EXAMPLE

The intent for this script was to run it as a nightly cronjob on a real-time system to help summarize various interactions with the datalogger (currently only tested on a Q330). It assumes that interactions via Willard are noted with a UMSG or via output from dlcmd. Hopefully, you can convince those who interact with the datalogger via a UMSG to use standard phrases... otherwise this script might be of little use. If the output from dlcmd changes, this script will likely be less effective. There have been multiple changes in the message format for q3302orb over the years, so results may vary depending on your log vintage.

A cronjob listing in rtexec.pf that runs on Thursday grabbing the previous week of data might look like:

logs2dlevent	UTC  00 12 * * 4 logs2dlevent -n 7 q330logs $DB

Capture information of interest from the previous year of logs, including any information from the current day using a locally modified log file.

logs2dlevent -n 365 -p mylogs2dlevent.pf -v q330logs year_of_logs

SEE ALSO

dlreport(1)
dlcmd(1)

BUGS AND CAVEATS

This has only been tested on output logs from q3302orb(1).

This program is very slow and very likely could be optimized.

The field size for the dlcomment is only 120 characters. I do not know what the limit on a UMSG size is so you may overflow the field.

There may be problems with the time subsetting, and crossing year boundaries: neither have been thoroughly tested.

It may take some adjustment of the parameter file to get (or reject) various events that you might find interesting.

Greps of log files which change format over time are obviously prone to errors. You may not get all of the information you want in the dlcomment field.

AUTHOR

Jennifer Eakins
ANF-IGPP-SIO-UCSD

Antelope User Group Contributed Software
Printer icon