PageRenderTime 65ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/IronPython_Main/Runtime/Tests/LinqDlrTests/testenv/perl/eg/core/scan/scan_messages

#
Perl | 222 lines | 215 code | 3 blank | 4 comment | 4 complexity | 939e05a35e0fb62902f623e935f673e5 MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  1. #!/usr/bin/perl -P
  2. # $RCSfile: scan_messages,v $$Revision: 4.1 $$Date: 92/08/07 17:20:37 $
  3. # This prints out extraordinary console messages. You'll need to customize.
  4. chdir('/usr/adm/private/memories') || die "Can't cd to memories: $!\n";
  5. $maxpos = `cat oldmsgs 2>&1`;
  6. #if defined(mc300) || defined(mc500) || defined(mc700)
  7. open(Msgs, '/dev/null') || die "scan_messages: can't open messages";
  8. #else
  9. open(Msgs, '/usr/adm/messages') || die "scan_messages: can't open messages";
  10. #endif
  11. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  12. $blksize,$blocks) = stat(Msgs);
  13. if ($size < $maxpos) { # Did somebody truncate messages file?
  14. $maxpos = 0;
  15. }
  16. seek(Msgs,$maxpos,0); # Start where we left off last time.
  17. while (<Msgs>) {
  18. s/\[(\d+)\]/#/ && s/$1/#/g;
  19. #ifdef vax
  20. $_ =~ s/[A-Z][a-z][a-z] +\w+ +[0-9:]+ +\w+ +//;
  21. next if /root@.*:/;
  22. next if /^vmunix: 4.3 BSD UNIX/;
  23. next if /^vmunix: Copyright/;
  24. next if /^vmunix: avail mem =/;
  25. next if /^vmunix: SBIA0 at /;
  26. next if /^vmunix: disk ra81 is/;
  27. next if /^vmunix: dmf. at uba/;
  28. next if /^vmunix: dmf.:.*asynch/;
  29. next if /^vmunix: ex. at uba/;
  30. next if /^vmunix: ex.: HW/;
  31. next if /^vmunix: il. at uba/;
  32. next if /^vmunix: il.: hardware/;
  33. next if /^vmunix: ra. at uba/;
  34. next if /^vmunix: ra.: media/;
  35. next if /^vmunix: real mem/;
  36. next if /^vmunix: syncing disks/;
  37. next if /^vmunix: tms/;
  38. next if /^vmunix: tmscp. at uba/;
  39. next if /^vmunix: uba. at /;
  40. next if /^vmunix: uda. at /;
  41. next if /^vmunix: uda.: unit . ONLIN/;
  42. next if /^vmunix: .*buffers containing/;
  43. next if /^syslogd: .*newslog/;
  44. #endif
  45. next if /unknown service/;
  46. next if /^\.\.\.$/;
  47. if (/^[A-Z][a-z][a-z] [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]/) {
  48. $pfx = '';
  49. next;
  50. }
  51. next if /^[ \t]*$/;
  52. next if /^[ 0-9]*done$/;
  53. if (/^A/) {
  54. next if /^Accounting [sr]/;
  55. }
  56. elsif (/^C/) {
  57. next if /^Called from/;
  58. next if /^Copyright/;
  59. }
  60. elsif (/^E/) {
  61. next if /^End traceback/;
  62. next if /^Ethernet address =/;
  63. }
  64. elsif (/^K/) {
  65. next if /^KERNEL MODE/;
  66. }
  67. elsif (/^R/) {
  68. next if /^Rebooting Unix/;
  69. }
  70. elsif (/^S/) {
  71. next if /^Sun UNIX 4\.2 Release/;
  72. }
  73. elsif (/^W/) {
  74. next if /^WARNING: clock gained/;
  75. }
  76. elsif (/^a/) {
  77. next if /^arg /;
  78. next if /^avail mem =/;
  79. }
  80. elsif (/^b/) {
  81. next if /^bwtwo[0-9] at /;
  82. }
  83. elsif (/^c/) {
  84. next if /^cgone[0-9] at /;
  85. next if /^cdp[0-9] at /;
  86. next if /^csr /;
  87. }
  88. elsif (/^d/) {
  89. next if /^dcpa: init/;
  90. next if /^done$/;
  91. next if /^dts/;
  92. next if /^dump i\/o error/;
  93. next if /^dumping to dev/;
  94. next if /^dump succeeded/;
  95. $pfx = '*' if /^dev = /;
  96. }
  97. elsif (/^e/) {
  98. next if /^end \*\*/;
  99. next if /^error in copy/;
  100. }
  101. elsif (/^f/) {
  102. next if /^found /;
  103. }
  104. elsif (/^i/) {
  105. next if /^ib[0-9] at /;
  106. next if /^ie[0-9] at /;
  107. }
  108. elsif (/^l/) {
  109. next if /^le[0-9] at /;
  110. }
  111. elsif (/^m/) {
  112. next if /^mem = /;
  113. next if /^mt[0-9] at /;
  114. next if /^mti[0-9] at /;
  115. $pfx = '*' if /^mode = /;
  116. }
  117. elsif (/^n/) {
  118. next if /^not found /;
  119. }
  120. elsif (/^p/) {
  121. next if /^page map /;
  122. next if /^pi[0-9] at /;
  123. $pfx = '*' if /^panic/;
  124. }
  125. elsif (/^q/) {
  126. next if /^qqq /;
  127. }
  128. elsif (/^r/) {
  129. next if /^read /;
  130. next if /^revarp: Requesting/;
  131. next if /^root [od]/;
  132. }
  133. elsif (/^s/) {
  134. next if /^sc[0-9] at /;
  135. next if /^sd[0-9] at /;
  136. next if /^sd[0-9]: </;
  137. next if /^si[0-9] at /;
  138. next if /^si_getstatus/;
  139. next if /^sk[0-9] at /;
  140. next if /^skioctl/;
  141. next if /^skopen/;
  142. next if /^skprobe/;
  143. next if /^skread/;
  144. next if /^skwrite/;
  145. next if /^sky[0-9] at /;
  146. next if /^st[0-9] at /;
  147. next if /^st0:.*load/;
  148. next if /^stat1 = /;
  149. next if /^syncing disks/;
  150. next if /^syslogd: going down on signal 15/;
  151. }
  152. elsif (/^t/) {
  153. next if /^timeout [0-9]/;
  154. next if /^tm[0-9] at /;
  155. next if /^tod[0-9] at /;
  156. next if /^tv [0-9]/;
  157. $pfx = '*' if /^trap address/;
  158. }
  159. elsif (/^u/) {
  160. next if /^unit nsk/;
  161. next if /^use one of/;
  162. $pfx = '' if /^using/;
  163. next if /^using [0-9]+ buffers/;
  164. }
  165. elsif (/^x/) {
  166. next if /^xy[0-9] at /;
  167. next if /^write [0-9]/;
  168. next if /^xy[0-9]: </;
  169. next if /^xyc[0-9] at /;
  170. }
  171. elsif (/^y/) {
  172. next if /^yyy [0-9]/;
  173. }
  174. elsif (/^z/) {
  175. next if /^zs[0-9] at /;
  176. }
  177. $pfx = '*' if /^[a-z]+:$/;
  178. s/pid [0-9]+: //;
  179. if (/last message repeated ([0-9]+) time/) {
  180. $seen{$last} += $1;
  181. next;
  182. }
  183. s/^/$pfx/ if $pfx;
  184. unless ($seen{$_}++) {
  185. push(@seen,$_);
  186. }
  187. $last = $_;
  188. }
  189. $max = tell(Msgs);
  190. open(tmp,'|sort >oldmsgs.tmp') || die "Can't create tmp file: $!\n";
  191. while ($_ = pop(@seen)) {
  192. print tmp $_;
  193. }
  194. close(tmp);
  195. open(tmp,'oldmsgs.tmp') || die "Can't reopen tmp file: $!\n";
  196. while (<tmp>) {
  197. if (/^nd:/) {
  198. next if $seen{$_} < 20;
  199. }
  200. if (/NFS/) {
  201. next if $seen{$_} < 20;
  202. }
  203. if (/no carrier/) {
  204. next if $seen{$_} < 20;
  205. }
  206. if (/silo overflow/) {
  207. next if $seen{$_} < 20;
  208. }
  209. print $seen{$_},":\t",$_;
  210. }
  211. print `rm -f oldmsgs.tmp 2>&1; echo $max > oldmsgs 2>&1`;