Fwd: LogWatch service script for dhcpd: extend recognition for DHCPOFFER, DHCPDECLINE, BOOTREPLY

"Kirk Bauer" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
---------- Forwarded message ----------
From: Niall O'Reilly <[email protected]>
Date: Jan 22, 2008 4:28 AM
Subject: LogWatch service script for dhcpd: extend recognition for
DHCPOFFER, DHCPDECLINE, BOOTREPLY
To: [email protected]
Cc: Niall O'Reilly <[email protected]>


This patch accepts a broader range of host-id strings in DHCPOFFER,
DHCPDECLINE
log entries, and accepts a second flavour of BOOTREPLY log entry.

The patch is also included as an attachment, in order to protect against
unwanted line-folding.

Note that a host-id string, as logged by dhcpd, may contain
whitespace and/or
punctuation (for example: apostrophe).  This leads LogWatch to
classify the
relevant log entry as "Unknown".

--- logwatch-script-dhcpd-1.18  2008-01-22 10:51:55.000000000 +0000
+++ logwatch-script-dhcpd-suggested     2008-01-22 11:15:34.000000000
+0000
@@ -90,19 +90,20 @@
        if ($Detail >= 5) {
           $data{'Addresses Leased'}{$line}++;
        }
-   } elsif ($line =~ s/^DHCPOFFER on ([\d\.]+) to ([a-f\d:]+) \(([a-
zA-Z\d_-]+)\) via (\S+)\s*$/$1 -> $2 [$3] ($4)/) {
+   } elsif ($line =~ s/^DHCPOFFER on ([\d\.]+) to ([a-f\d:]+) \(([^)]
+)\) via (\S+)\s*$/$1 -> $2 [$3] ($4)/) {
        if ($Detail >= 5) {
           $data{'Addresses Leased'}{$line}++;
        }
-   } elsif ($line =~ s/^DHCPDECLINE of ([\d\.]+) from ([\w:]+) \(([a-
zA-Z\d_-]+)\) via (\S+)\s*$/$1 -> $2 [$3] ($4)/) {
+   } elsif ($line =~ s/^DHCPDECLINE of ([\d\.]+) from ([\w:]+) \
(([^)]+)\) via (\S+)\s*$/$1 -> $2 [$3] ($4)/) {
        if ($Detail >= 5) {
           $data{'Addresses Declined'}{$line}++;
        }
-   } elsif ($line =~ s/^DHCPOFFER on ([\d\.]+) to ("") \(([a-zA-Z
\d_-]+)\) via (\S+)\s*$/$1 -> $2 [$3] ($4)/) {
+   } elsif ($line =~ s/^DHCPOFFER on ([\d\.]+) to ("") \(([^)]+)\)
via (\S+)\s*$/$1 -> $2 [$3] ($4)/) {
        if ($Detail >= 5) {
           $data{'Warnings'}{$line}++;
        }
-   } elsif ($line =~ s/^BOOTREPLY for ([\d\.]+) to ([a-zA-Z\d_-]+) \
(([a-f\d:]+)\) via (\S+)\s*$/$1 -> $3 [$2] ($4\/bootp)/) {
+   } elsif ( ($line =~ s/^BOOTREPLY for ([\d\.]+) to ([a-zA-Z\d_-]+)
\(([a-f\d:]+)\) via (\S+)\s*$/$1 -> $3 [$2] ($4\/bootp)/)
+             or ($line =~ s/^BOOTREPLY on ([\d\.]+) to ([a-f\d:]+)
via (\S+)\s*$/$1 -> $2 [] ($3\/bootp)/) ) {
        if ($Detail >= 5) {
           $data{'Addresses Leased'}{$line}++;
        }








-- 
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration

_______________________________________________
Logwatch-Devel mailing list
[email protected]
http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
logwatch-script-dhcpd.diff-u (application/octet-stream, 1.6 KB) - not displayed
PGP.sig (application/pgp-signature, 186 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.