📄 innlog.awk
字号:
## $Revision: 1.7 $## @(#) newsinfo.awk falcon@cats.ucsc.edu (jon r. luini) 7/4/92## Modified by Robert Elz to understand more reports.## Modified by Rich $alz for consistent formatting.## Modified by Chris Schmidt to sort output.BEGIN { unknowns = 0; batcher = 0; client_timeout = 0; ctlinnd_new = 0; ctlinnd_rmg = 0; ctlinnd_seen = 0; innd = 0; innd_bad_ihaves = 0; innd_bad_msgids = 0; innd_bad_sendmes = 0; innd_blockeds = 0; innd_change_groups = 0; innd_newgroups = 0; innd_pauses = 0; innd_points = 0; innd_reloads = 0; innd_restarts = 0; innd_rmgroups = 0; innd_shutdowns = 0; innd_throttles = 0; innxmit = 0; invalid = "~~~~~~~~~~~~~~~~~~~~~~~~" mthreads = 0; mthreads_added = 0; mthreads_expired = 0; mthreads_started = 0; mthreads_turned_off = 0; mthreads_turned_on = 0; nnrp = 0; nnrp_gethostfails = 0; nnrp_noperms = 0; nnrp_readers = 0; nnrp_unrecs = 0; nntplink = 0; rnews_bad = 0; rnews_bad_date = 0; rnews_bad_dist = 0; rnews_bad_ng = 0; rnews_host = 0; rnews_host = 0; rnews_rejects = 0; server_timeout = 0; ctlinnd["a"] = "addhist"; ctlinnd["D"] = "allow"; ctlinnd["b"] = "begin"; ctlinnd["c"] = "cancel"; ctlinnd["u"] = "changegroup"; ctlinnd["d"] = "checkfile"; ctlinnd["e"] = "drop"; ctlinnd["f"] = "flush"; ctlinnd["g"] = "flushlogs"; ctlinnd["h"] = "go"; ctlinnd["i"] = "hangup"; ctlinnd["s"] = "mode"; ctlinnd["j"] = "name"; ctlinnd["k"] = "newgroup"; ctlinnd["l"] = "param"; ctlinnd["m"] = "pause"; ctlinnd["v"] = "readers"; ctlinnd["t"] = "refile"; ctlinnd["C"] = "reject"; ctlinnd["o"] = "reload"; ctlinnd["n"] = "renumber"; ctlinnd["z"] = "reserve"; ctlinnd["p"] = "rmgroup"; ctlinnd["A"] = "send"; ctlinnd["q"] = "shutdown"; ctlinnd["B"] = "signal"; ctlinnd["r"] = "throttle"; ctlinnd["w"] = "trace"; ctlinnd["x"] = "xabort"; ctlinnd["y"] = "xexec";}#### SYSLOG##$5 == "last" && $6 == "message" && $7 == "repeated" { ## Skip. next;}#### NNRP##$5 ~ /nnrpd.*/ { host = $6; if ($7 == "connect") { nnrp_connect[host]++; nnrp = 1; next; } if ($7 == "exit") { nnrp_articles[host] += $9; nnrp_groups[host] += $11; next; } if ($7 == "posts") { nnrp_posts[host] += $9; nnrp_rejected[host] += $11; next; } if ($7 == "times") { nnrp_times_user[host] += $9; nnrp_times_sys[host] += $11; nnrp_times_elapsed[host] += $13; next; } if ($7 == "group") { nnrp_readers = 1; nnrp_group_request[$8]++; next; } if ($7 == "post") { ## Skip; handled in "posts" above. next; } if ($7 == "unrecognized") { nnrp_unrecs = 1; nnrp_unrec[host]++; next; } if ($7 == "no_permission") { nnrp_noperms = 1; nnrp_noperm[host]++; next; } if ($7 == "timeout") { client_timeout = 1; nnrp_timeout[host]++; next; } if ($6 == "gethostbyaddr:") { nnrp_gethostfails = 1; nnrp_gethostfail[$7]++; next; } if ($7 == "cant" && $8 == "gethostbyaddr") { ## Skip; handled in "gethostbyaddr:" above. next; }}#### INND##$5 == "innd:" { innd = 1; if ( $6 ~ /^[a-zA-Z]:.*/ || $6 ~ /^[dgs]$/ ) { ## A ctlinnd command. ## Note that the last parameter in $6 may be continued in $7 etc n = split($6, ctl, ":"); if (ctlinnd[ctl[1]] == "") { ## Unknown; update this script! print; next; } ctlinnd_type[ctl[1]]++; ctlinnd_seen++; if (ctl[1] == "k") { ## Newgroup. Process it here so we can get the creator. ctlinnd_new++; ctlinnd_newgroups[ctl[2]] = ctl[4]; next; } if (ctl[1] == "p") { ## Rmgroup. Process it here for symmetry. ctlinnd_rmg++; ctlinnd_rmgroups[ctl[2]] = 1; next; } ## Skip others for now. next; } if ( $6 ~ /.*:.*/ ) { n = split($6, path, ":"); host = path[1]; } else host = $6; if ($7 == "connected") { ## Account for the fact that innd says "local connected ##" ## and then "localhost:## closed" if (host == "local") { host = "localhost"; } innd_connect[host]++; next; } if ($7 == "closed") { innd_seconds[host] += $9; innd_accepted[host] += $11; innd_refused[host] += $13; innd_rejected[host] += $15; innd_chkp[host] = 0; if (cp_innd_chkp[host] == 1) { cp_innd_chkp[host] = 0; innd_points--; } next; } if ($7 == "checkpoint") { cp_innd_seconds[host] = $9; cp_innd_accepted[host] = $11; cp_innd_refused[host] = $13; cp_innd_rejected[host] = $15; if (cp_innd_chkp[host] == 0) { cp_innd_chkp[host] = 1; innd_points++; } next; } if ($6 ~ /\/.*/) { ## Skip; handled by "opened/spawned" below. next; } if ($7 == "flush") { innd_flush[host]++; next; } if ($7 == "timeout") { innd_timeout[host]++; next; } if ($7 == "opened" || $7 == "spawned") { n = split($8, blarg, ":"); innd_feed[host] = blarg[n]; next; } if ($7 == "newgroup") { innd_newgroups++; next; } if ($7 == "rmgroup") { innd_rmgroups++; next; } if ($7 == "paused") { innd_pauses++; next; } if ($7 == "throttled") { innd_throttles++; next; } if ($7 == "reload") { innd_reloads++; next; } if ($7 == "change_group") { innd_change_groups++; next; } if ($7 == "shutdown") { innd_shutdowns++; next; } if ($7 == "starting") { innd_restarts++; if (innd_points != 0) { ## Unfinished checkpoints from before; something crashed. for (s in cp_innd_chkp) { if (cp_innd_chkp[s] == 0) continue; innd_seconds[s] += cp_innd_seconds[s]; innd_accepted[s] += cp_innd_accepted[s]; innd_refused[s] += cp_innd_refused[s]; innd_rejected[s] += cp_innd_rejected[s]; cp_innd_chkp[s] = 0; } innd_points = 0; } next; } if ($7 == "bad_ihave") { innd_bad_ihave[host]++; innd_bad_ihaves = 1; next; } if ($7 == "ihave_from_me") { next; } if ($7 == "bad_messageid") { innd_bad_msgid[host]++; innd_bad_msgids = 1; next; } if ($7 == "bad_sendme") { innd_bad_sendme[host]++; innd_bad_sendmes = 1; next; } if ($7 == "blocked" && $8 == "sleeping") { innd_blocked[host]++; innd_blockeds = 1; next; } if ($7 == "exit" && $8 == "0") { ## Program or process finished normally; don't care. next; } if ($7 == "wakeup" || ($7 == "cant" && ($8 == "write" || $8 == "read"))) { ## Skip; handled by "blocked/sleeping" above. next; } if ($7 == "inactive" || $7 == "descriptors" \ || $7 == "outgoing" || $7 == "running" \ || $7 == "lcsetup" || $7 == "ccsetup" \ || $7 == "rcsetup" || $7 == "readclose" \ || $7 == "flush_all" \ ) { ## Skip; for now. next; }}#### BATCHER##$5 ~ /batcher.*/ { host = $7; ## Since times lines are always followed by stats lines, we ## only do the batcher_site[host]++ and batcher=1 once if ($8 == "times") { batcher_times_user[host] += $10; batcher_times_sys[host] += $12; batcher_times_elapsed[host] += $14; batcher_site[host]++; batcher = 1; next; } if ($8 == "stats") { batcher_num[host] += $10; batcher_articles[host] += $12; batcher_bytes[host] += $14; next; }}#### INNXMIT##$5 ~ /innxmit.*/ { if ( $6 ~ /:/ ) { n = split($6, path, ":"); host = path[1]; } else host = $6; if ($7 == "ihave" && $8 == "failed") { ## ihave failed occurs when the server rejects an article, ## and requests it to be resent at the ihave stage - this ## always indicates a server problem (all it has of the article ## is its message-id) most commonly "out of space" - in that ## case we don't really want to count this as an offered ## article, so remember this happened so we can reduce the ## offered count below. innxmit_ihfail[host] = 1; if ($9 == "436" && $11 == "NNTP" && $13 == "out" && $15 ~ /space/) { innxmit_nospace[host]++; next; } } ## Since stats lines are always followed by times lines we ## only do the innxmit_site[host]++ and innxmit=1 once if ($7 == "stats") { innxmit_offered[host] += $9 - innxmit_ihfail[host]; innxmit_accepted[host] += $11; innxmit_rejected[host] += $13; innxmit_failed[host] += $15; innxmit_ihfail[host] = 0; innxmit_site[host]++; innxmit = 1; next; } if ($7 == "times") { innxmit_times_user[host] += $9; innxmit_times_sys[host] += $11; innxmit_times_elapsed[host] += $13; next; } if ($7 == "requeued") { r = $9; for (i = 10; i < NF; i++) r = r " " $i; innxmit_reQ_host[host]++; innxmit_reQ_reason[r]++; next; } if ($7 == "connect" && $9 == "400" \ && (($10 == "No" && $11 == "space") \ || ($11 == "NNTP" && $13 == "out" && $15 ~ /space/))) { ## There is no startup marked for this. innxmit_site[host]++; innxmit_nospace[host]++; next; } if ($7 == "connect" && $9 == "400" && $10 == "loadav") { ## There is no startup marked for this. innxmit_site[host]++; innxmit_hiload[host]++; next; } if ($7 == "connect" && $9 == "400" && $0 ~ /[Ee][Xx][Pp][Ii][Rr]/) { ## There is no startup marked for this. innxmit_site[host]++; innxmit_expire[host]++; next; } if ($7 == "connect" && $9 == "400") { ## There is no startup marked for this. innxmit_site[host]++; innxmit_crefused[host]++; next; } if ($7 == "connect" && $8 == "failed") { ## There is no startup marked for this. innxmit_site[host]++; innxmit_cfail_host[host]++; ## Later, maybe. #r = $9; #for (i = 10; i < NF; i++) # r = r " " $i; #innxmit_cfail_reason[r]++; next; } if ($7 == "authenticate" && $8 == "failed") { ## There is no startup marked for this. innxmit_site[host]++; innxmit_afail_host[host]++; ## Later, maybe. #r = $9; #for (i = 10; i < NF; i++) # r = r " " $i; #innxmit_afail_reason[r]++; next; }}$5 ~ /rnews.*/ { if ($6 == "rejected") { if ($7 == "connection") { rnews_rejects++; i = 8; if ($8 == "400") i++; n = $i; for (i++; i <= NF; i++) n = n " " $i; rnews_r_reject[n]++; next; } if ($7 == "437") { rnews_bad++; if ($8 == "Unwanted" && $9 == "newsgroup") { rnews_bad_ng++; rnews_bng[$10]++; next;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -