3 # $Header: scan_messages,v 3.0 89/10/18 15:15:38 lwall Locked $
5 # This prints out extraordinary console messages. You'll need to customize.
7 chdir('/usr/adm/private/memories') || die "Can't cd to memories: $!\n";
9 $maxpos = `cat oldmsgs 2>&1`;
11 #if defined(mc300) || defined(mc500) || defined(mc700)
12 open(Msgs, '/dev/null') || die "scan_messages: can't open messages";
14 open(Msgs, '/usr/adm/messages') || die "scan_messages: can't open messages";
17 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
18 $blksize,$blocks) = stat(Msgs);
20 if ($size < $maxpos) { # Did somebody truncate messages file?
24 seek(Msgs,$maxpos,0); # Start where we left off last time.
27 s/\[(\d+)\]/#/ && s/$1/#/g;
29 $_ =~ s/[A-Z][a-z][a-z] +\w+ +[0-9:]+ +\w+ +//;
31 next if /^vmunix: 4.3 BSD UNIX/;
32 next if /^vmunix: Copyright/;
33 next if /^vmunix: avail mem =/;
34 next if /^vmunix: SBIA0 at /;
35 next if /^vmunix: disk ra81 is/;
36 next if /^vmunix: dmf. at uba/;
37 next if /^vmunix: dmf.:.*asynch/;
38 next if /^vmunix: ex. at uba/;
39 next if /^vmunix: ex.: HW/;
40 next if /^vmunix: il. at uba/;
41 next if /^vmunix: il.: hardware/;
42 next if /^vmunix: ra. at uba/;
43 next if /^vmunix: ra.: media/;
44 next if /^vmunix: real mem/;
45 next if /^vmunix: syncing disks/;
46 next if /^vmunix: tms/;
47 next if /^vmunix: tmscp. at uba/;
48 next if /^vmunix: uba. at /;
49 next if /^vmunix: uda. at /;
50 next if /^vmunix: uda.: unit . ONLIN/;
51 next if /^vmunix: .*buffers containing/;
52 next if /^syslogd: .*newslog/;
54 next if /unknown service/;
56 if (/^[A-Z][a-z][a-z] [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]/) {
61 next if /^[ 0-9]*done$/;
63 next if /^Accounting [sr]/;
66 next if /^Called from/;
70 next if /^End traceback/;
71 next if /^Ethernet address =/;
74 next if /^KERNEL MODE/;
77 next if /^Rebooting Unix/;
80 next if /^Sun UNIX 4\.2 Release/;
83 next if /^WARNING: clock gained/;
87 next if /^avail mem =/;
90 next if /^bwtwo[0-9] at /;
93 next if /^cgone[0-9] at /;
94 next if /^cdp[0-9] at /;
98 next if /^dcpa: init/;
101 next if /^dump i\/o error/;
102 next if /^dumping to dev/;
103 next if /^dump succeeded/;
104 $pfx = '*' if /^dev = /;
108 next if /^error in copy/;
114 next if /^ib[0-9] at /;
115 next if /^ie[0-9] at /;
118 next if /^le[0-9] at /;
122 next if /^mt[0-9] at /;
123 next if /^mti[0-9] at /;
124 $pfx = '*' if /^mode = /;
127 next if /^not found /;
130 next if /^page map /;
131 next if /^pi[0-9] at /;
132 $pfx = '*' if /^panic/;
139 next if /^revarp: Requesting/;
140 next if /^root [od]/;
143 next if /^sc[0-9] at /;
144 next if /^sd[0-9] at /;
145 next if /^sd[0-9]: </;
146 next if /^si[0-9] at /;
147 next if /^si_getstatus/;
148 next if /^sk[0-9] at /;
154 next if /^sky[0-9] at /;
155 next if /^st[0-9] at /;
156 next if /^st0:.*load/;
158 next if /^syncing disks/;
159 next if /^syslogd: going down on signal 15/;
162 next if /^timeout [0-9]/;
163 next if /^tm[0-9] at /;
164 next if /^tod[0-9] at /;
166 $pfx = '*' if /^trap address/;
170 next if /^use one of/;
171 $pfx = '' if /^using/;
172 next if /^using [0-9]+ buffers/;
175 next if /^xy[0-9] at /;
176 next if /^write [0-9]/;
177 next if /^xy[0-9]: </;
178 next if /^xyc[0-9] at /;
181 next if /^yyy [0-9]/;
184 next if /^zs[0-9] at /;
186 $pfx = '*' if /^[a-z]+:$/;
188 if (/last message repeated ([0-9]+) time/) {
193 unless ($seen{$_}++) {
200 open(tmp,'|sort >oldmsgs.tmp') || die "Can't create tmp file: $!\n";
201 while ($_ = pop(@seen)) {
205 open(tmp,'oldmsgs.tmp') || die "Can't reopen tmp file: $!\n";
208 next if $seen{$_} < 20;
211 next if $seen{$_} < 20;
214 next if $seen{$_} < 20;
216 if (/silo overflow/) {
217 next if $seen{$_} < 20;
219 print $seen{$_},":\t",$_;
222 print `rm -f oldmsgs.tmp 2>&1; echo $max > oldmsgs 2>&1`;