Mar 26, 2007

YaST Log Summarizer

When dealing with YaST logs, it happens every now and then that you wade through the voluminous output only to discover that you are looking at the wrong run and the bug happened three days after the start of the log file.

So I wrote a simple log summarizer y2logpids, that shows the first and last lines for each process ID in the log. And as a side feature, it also measures time differences for the case where the reporter says "and then it hangs for 30 minutes".

$ y2logpids -h
y2logpids -h|--help
y2logpids [-m] [-d [<seconds>]] [log-files]

Options and Arguments:
-m, --maximum
Show the maximum time difference between log lines, within a single

-d [seconds], --difference[=seconds]
Show where the time difference is larger than seconds (60 if
unspecified), within a single PID

$ wc -l logs/255012-y2log
23501 logs/255012-y2log
$ y2logpids logs/255012-y2log
2007-03-20 11:13:31 <1> e111(4034) [liby2] Launched YaST2 component 'y2base' 'inst_suse_register' 'qt' ''
2007-03-20 11:13:45 <1> e111(4034) [media] Restored HAL volume handling (automounter)
2007-03-20 11:14:15 <1> e111(4222) [liby2] Launched YaST2 component 'y2base' 'inst_suse_register' 'qt' ''
2007-03-20 11:29:07 <1> e111(4222) [media] Restored HAL volume handling (automounter)
2007-03-20 11:32:51 <1> e111(5265) [liby2] Launched YaST2 component 'y2base' 'online_update' 'qt' ''
2007-03-20 11:33:12 <1> e111(5265) [media] Restored HAL volume handling (automounter)
2007-03-20 11:34:07 <1> e111(5310) [liby2] Launched YaST2 component 'y2base' 'online_update' 'qt' ''
2007-03-20 12:02:02 <1> e111(5310) [YCP] OnlineUpdateCallbacks.ycp:50 PatchProgressCallback 100
2007-03-20 12:02:18 <1> e111(7003) [liby2] Launched YaST2 component 'y2base' 'print-product' 'qt' ''
2007-03-20 12:03:51 <1> e111(7003) [zypp] unlocked
2007-03-20 12:03:55 <0> e111(5310) [zypp] pid 5881 successfully completed
2007-03-20 12:24:22 <1> e111(5310) [media] Restored HAL volume handling (automounter)
2007-03-20 12:35:41 <1> e111(8715) [liby2] Launched YaST2 component 'y2base' 'online_update' 'qt' ''
2007-03-20 12:38:51 <1> e111(8715) [media] Restored HAL volume handling (automounter)

Download the script.

1 comment:

Martin Vidner said...

Eh, I've just realized that the use Date::Parse; adds a dependency on perl-TimeDate.rpm. I will try to make that dependency an optional one.