source: udev/show_event_log@ 9e8d8ae

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 9e8d8ae was 9aa77af, checked in by Jim Gifford <clfs@…>, 18 years ago

Fix show_event_log

  • Property mode set to 100755
File size: 2.3 KB
Line 
1#!/bin/sh
2########################################################################
3#
4# Description : show_event_log
5#
6# Authors : Based on Open Suse Udev Rules
7# kay.sievers@suse.de
8#
9# Adapted to : Jim Gifford
10# LFS
11#
12# Version : 00.00
13#
14# Notes :
15#
16########################################################################
17#
18# extract udev log messages from a syslog file
19# show_event_log <first> [<last> [<list of event types>] ]
20#
21# known events are:
22# ac97 acpi block cpu drivers edd firmware graphics i2c-adapter i8259
23# ieee1394_protocol input ioapic irqrouter lapic mem misc module namespace
24# pci_bus pci_express pcmcia pcmcia_socket platform pnp printer scsi scsi_host
25# serio sound timer timer_pit tty usb usb_device usb_host vc
26#
27# GPL, version 2
28# Christian Zoz <zoz@suse.de>
29#
30
31EXCLUDE_SUBS="acpi cpu edd mem namespace pci_bus tty vc"
32MESSAGES=${MESSAGES:-/var/log/messages.log}
33
34show_event() {
35 local SN PID SUBS
36 declare -i SN=$1 PID
37 read PID ACT SUBS < <(sed -n "s/^.*seq $SN forked, pid \[\([0-9]*\)\], '\([^']*\)' '\([^']*\)'.*$/\1 \2 \3/p;T;q" $MESSAGES)
38 if [ $PID == 0 ] ; then
39 echo event $SN not found 1>&2
40 return 1
41 fi
42 if [ -n "$WANTED_SUBS" ] ; then
43 WANTED=no
44 for S in $WANTED_SUBS; do
45 test "$SUBS" == "$S" && WANTED=yes
46 done
47 else
48 WANTED=yes
49 for S in $EXCLUDE_SUBS; do
50 test "$SUBS" == "$S" && WANTED=no
51 done
52 fi
53 echo event $SN $PID $ACT $SUBS $WANTED 1>&2
54 test $WANTED == no && return 1
55 echo " _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ $SN _ $ACT _ $SUBS _ _ _ _"
56 grep "seq $SN \|\[$PID\]" $MESSAGES |
57 grep -v "pass_env\|geventrec\|hal.hot"
58 echo
59}
60
61declare -i START=$1 STOP=$2
62if [ "$2" == last ] ; then
63 read STOP_STRING < <(grep -o "udev_done.*exit" $MESSAGES | cut -d" " -f3 | sort -n | tail -1)
64 STOP=`echo $STOP_STRING | sed 's/^[^0-9]*\([0-9]\+\).*$/\1/'`
65fi
66test $START -lt 0 -a $STOP -gt 0 && START=$((STOP+START+1))
67test $START -gt $STOP && STOP=$START
68shift; shift; WANTED_SUBS="$*"
69for n in `seq $START $STOP`; do
70 show_event $n
71done
72
73exit
74
75# list all events
76(read x; while read x s x x x c x; read x s2 x a d; do echo $s $s2 $a $c $d; done) < <( sed -n "s/^.*udev.*\(seq [0-9]* [qf].*$\)/\1/p" /var/log/messages | sort -n -k 2 | tr -d ',' )
77
78./show_event_log 1 last > boot.events.log.`date +%A_%H:%M` 2> boot.events.list.`date +%A_%H:%M`
Note: See TracBrowser for help on using the repository browser.