Build a custom log entry on a DHCPACK CentOS 6.

Mark Haney mark.haney at neonova.net
Tue May 30 12:02:10 UTC 2017


Well, it sort of works that way.  The issue now is it is logging it 
twice.  Which doesn't make sense to me in any way.  I only posted half 
the 'if' statement, but logically the else shouldn't matter.  Why is /on 
commit/ logging 2 (and sometimes 3) entries for one DHCPACK?



On 05/26/2017 03:23 PM, Bob Harold wrote:
>
> On Fri, May 26, 2017 at 3:08 PM, Mark Haney <mark.haney at neonova.net 
> <mailto:mark.haney at neonova.net>> wrote:
>
>     Okay, let me see if I get this straight, I should wrap the entire
>     if statement inside an 'on commit {}' block?
>
>
> Yes
>
> on commit {
> if exists agent.circuit-id
>  {
>         log (info, concat( "DHCPUSER:,", concat (suffix (concat ("0", 
> binary-to-ascii (16, 8, "", substring( hardware, 1, 1))),2), ":", 
> suffix (concat ("0", binary-to-ascii (16, 8, "",substring( hardware, 
> 2, 1))),2), ":", suffix (concat ("0", binary-to-ascii(16, 8, "", 
> substring( hardware, 3, 1))),2), ":", suffix (concat ("0", 
> binary-to-ascii (16, 8, "", substring( hardware, 4, 1))),2),":", 
> suffix (concat ("0", binary-to-ascii (16, 8, "", substring( hardware, 
> 5, 1))),2), ":", suffix (concat ("0", binary-to-ascii (16, 8, "", 
> substring( hardware, 6, 1))),2)), ",IP:,", binary-to-ascii (10, 8, 
> ".", leased-address), ",CID:,", option agent.circuit-id));
>  }
> }
>
> -- 
> Bob Harold
>
>     On Fri, May 26, 2017 at 2:56 PM, Bob Harold <rharolde at umich.edu
>     <mailto:rharolde at umich.edu>> wrote:
>
>
>         On Fri, May 26, 2017 at 11:38 AM, Mark Haney
>         <mark.haney at neonova.net <mailto:mark.haney at neonova.net>> wrote:
>
>             We've got a custom log entry created that's based on
>             whether the agent.circuit-id exists.  The problem is that
>             the circuit-id gets included in DHCPDISCOVER and
>             DHCPOFFER, so we're getting duplicate custom messages logged.
>
>             What we want to do it create this custom log file, with
>             the circuit-id only on the DHCPACK. The log creation
>             params are below.  We use this so that customers can get a
>             web interface view of the current leases.
>
>             Is there a way to do this with the latest CentOS 6 dhcpd
>             package?
>
>             ----
>             if exists agent.circuit-id
>              {
>                     log (info, concat( "DHCPUSER:,", concat (suffix
>             (concat ("0", binary-to-ascii (16, 8, "", substring(
>             hardware, 1, 1))),2), ":", suffix (concat ("0",
>             binary-to-ascii (16, 8, "",substring( hardware, 2,
>             1))),2), ":", suffix (concat ("0", binary-to-ascii(16, 8,
>             "", substring( hardware, 3, 1))),2), ":", suffix (concat
>             ("0", binary-to-ascii (16, 8, "", substring( hardware, 4,
>             1))),2),":", suffix (concat ("0", binary-to-ascii (16, 8,
>             "", substring( hardware, 5, 1))),2), ":", suffix (concat
>             ("0", binary-to-ascii (16, 8, "", substring( hardware, 6,
>             1))),2)), ",IP:,", binary-to-ascii (10, 8, ".",
>             leased-address), ",CID:,", option agent.circuit-id));
>              }
>
>
>             -- 
>             photo 	
>             Mark Haney
>             Network Engineer at NeoNova
>
>             919-460-3330 <tel:%28919%29%20460-3330> (opt 1) •
>             mark.haney at neonova.net <http://matt@neonova.net/>
>             www.neonova.net <https://neonova.net/>
>             <https://www.facebook.com/NeoNovaNNS/>
>             <https://twitter.com/NeoNova_NNS>
>             <http://www.linkedin.com/company/neonova-network-services>
>
>
>
>         Try wrapping that with:
>            on commit {
>            ...
>            }
>
>         Then it should only happen once, when the lease is granted.
>
>         -- 
>         Bob Harold
>
>         _______________________________________________
>         dhcp-users mailing list
>         dhcp-users at lists.isc.org <mailto:dhcp-users at lists.isc.org>
>         https://lists.isc.org/mailman/listinfo/dhcp-users
>         <https://lists.isc.org/mailman/listinfo/dhcp-users>
>
>
>
>
>     -- 
>     photo 	
>     Mark Haney
>     Network Engineer at NeoNova
>
>     919-460-3330 <tel:%28919%29%20460-3330> (opt 1) •
>     mark.haney at neonova.net <mailto:mark.haney at neonova.net>
>     www.neonova.net <https://neonova.net/>
>     <https://www.facebook.com/NeoNovaNNS/>
>     <https://twitter.com/NeoNova_NNS>
>     <http://www.linkedin.com/company/neonova-network-services>
>
>
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20170530/28923f2c/attachment-0001.html>


More information about the dhcp-users mailing list