Logging DISCOVER messages

Glenn Satchell Glenn.Satchell at uniq.com.au
Fri Feb 16 10:35:51 UTC 2007


>X-Original-To: dhcp-users at webster.isc.org
>X-Greylist: delayed 724 seconds by postgrey-1.27 at post.isc.org; Fri, 16 Feb 
2007 10:17:52 UTC
>Content-class: urn:content-classes:message
>Subject: Logging DISCOVER messages
>Date: Fri, 16 Feb 2007 11:05:44 +0100
>Thread-Topic: Logging DISCOVER messages
>Thread-Index: AcdRsgX2ODa1qnBPRFOouP9N0mNMaw==
>From: <Staffan.Ungsgard at teliasonera.com>
>To: <dhcp-users at isc.org>
>X-OriginalArrivalTime: 16 Feb 2007 10:05:45.0354 (UTC) 
FILETIME=[063566A0:01C751B2]
>X-archive-position: 2858
>X-ecartis-version: Ecartis v1.0.0
>X-original-sender: Staffan.Ungsgard at teliasonera.com
>List-software: Ecartis version 1.0.0
>X-List-ID: <dhcp-users.isc.org>
>X-list: dhcp-users
>
>Hi
>Is there a way to log DISCOVER messages along with option 82 information in one 
line in the log file.
>Today I log the option 82 info using on commit as:
>
>on commit {
>  log(info, concat("dhcplog: ; ",option agent.remote-id, " ; ",binary-to-ascii 
(10, 8, ".", leased-address)," ; " , binary-to-ascii\
>(16, 8, ":", substring(hardware, 1, 6))  ));
>}
>
>This gives an output like:
>Feb 16 00:21:04 dhcp3 dhcpd: [ID 702911 local0.info] dhcplog: ; 
OPTION-82-INFO-HERE ; 192.168.3.90 ; 0:31:f3:d6:f2:7c
>
>I would like to log this only when there is a DISCOVER message instead of every 
time the address is committed. Is this possible.

Add a test for option dhcp-message-type. This is covered in the
dhcp-options man page.

if (option dhcp-message-type = 1) {
  log(info, concat("dhcplog: ; ",
    option agent.remote-id, " ; ",
    binary-to-ascii (10, 8, ".", leased-address)," ; " ,
    binary-to-ascii (16, 8, ":", substring(hardware, 1, 6))  ));
}

regards,
-glenn


More information about the dhcp-users mailing list