Selective logging of Option82 markets

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Selective logging of Option82 markets

project722
I'm using a global statement which allows me to log all data that comes into the server with Option82 in it. Here is what I am using:

if((option dhcp-message-type = 3 or option dhcp-message-type = 5) and
      exists agent.circuit-id) {

    log(info, concat( "OPTION-82 | IP =",
        binary-to-ascii (10, 8, ".",leased-address),
        " | MAC=",
        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),
        #" | CIRCUIT-ID=",
        #binary-to-ascii (10, 8, ".", option agent.circuit-id),   
        #" | REMOTE-ID=", 
        #binary-to-ascii (10, 8, ".", option agent.remote-id),
        " | CIRCUIT-ID=",
        substring( option agent.circuit-id, 0, 9999),
        " | REMOTE-ID=",
        substring( option agent.remote-id, 0, 9999)));
}

We have about 25 markets, or "pools", subnet declarations, whatever you want to call it. Some of which are test markets we are using for internal use. I need the ability to enable/disable option82 logging for these markets. I'd rather keep the logging statement global then disable only the few internal use markets that I need to. Is there a way to accomplish this. 

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Selective logging of Option82 markets

glenn.satchell
I don't have a specific answer to your question, but I noticed the
suffix(concat()) usage from a post I originally made way back in 2003. So
great to see that it is still in widespread use.

Original post:

    http://marc.info/?l=dhcp-server&m=105689607527110&w=2

regards,
-glenn

On Thu, October 13, 2016 1:28 am, project722 wrote:

> I'm using a global statement which allows me to log all data that comes
> into the server with Option82 in it. Here is what I am using:
>
> if((option dhcp-message-type = 3 or option dhcp-message-type = 5) and
>       exists agent.circuit-id) {
>
>     log(info, concat( "OPTION-82 | IP =",
>         binary-to-ascii (10, 8, ".",leased-address),
>         " | MAC=",
>         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),
>         #" | CIRCUIT-ID=",
>         #binary-to-ascii (10, 8, ".", option agent.circuit-id),
>         #" | REMOTE-ID=",
>         #binary-to-ascii (10, 8, ".", option agent.remote-id),
>         " | CIRCUIT-ID=",
>         substring( option agent.circuit-id, 0, 9999),
>         " | REMOTE-ID=",
>         substring( option agent.remote-id, 0, 9999)));
> }
>
> We have about 25 markets, or "pools", subnet declarations, whatever you
> want to call it. Some of which are test markets we are using for internal
> use. I need the ability to enable/disable option82 logging for these
> markets. I'd rather keep the logging statement global then disable only
> the
> few internal use markets that I need to. Is there a way to accomplish
> this.



_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: Selective logging of Option82 markets

Peter Rathlev
In reply to this post by project722
On Wed, 2016-10-12 at 09:28 -0500, project722 wrote:
> I'm using a global statement which allows me to log all data that
> comes into the server with Option82 in it. Here is what I am using:
>
> if((option dhcp-message-type = 3 or option dhcp-message-type = 5) and
>       exists agent.circuit-id) {
>
>     log(info, concat( "OPTION-82 | IP =",
...
> We have about 25 markets, or "pools", subnet declarations, whatever
> you want to call it. Some of which are test markets we are using for
> internal use. I need the ability to enable/disable option82 logging
> for these markets. I'd rather keep the logging statement global then
> disable only the few internal use markets that I need to. Is there a
> way to accomplish this.

We use "config-option" selectors in class-statements, you might be able
to do the same with your log statement. An example:

   option X-Siedle-Options code 253 = string;

   class "Siedle" {
       match if substring(hardware, 1, 3) = d4:e3:2c;
       if (config-option X-Siedle-Options = "LOCATOR-ID") {
           set X-Siedle-Options-served = "LOCATOR-ID";
           option time-servers 192.0.2.234;
           option log-servers 192.0.2.234;
           option ntp-servers 192.0.2.234;
           option tftp-server-name "192.0.2.234";
           option bootfile-name "SSS/Axxx/locator.xml";
       }
   }
   
   group {
       option X-Siedle-Options "LOCATOR-ID";
       subnet 198.51.100.0 netmask 255.255.255.0 {
           option routers 198.51.100.1;
           pool {
               failover peer "rmnet-failover"; 
               range 198.51.100.50 198.51.100.239;
           }
       }
   }

You might be able to attach a custom option to the subnets that
shouldn't be logged and then add

  ... and not (pick-first-value(config-option OPTION-NAME, "") = "SOMETHING")

to your existing "if" statement.

I'm not certain it will work though. It might depend on how much state
is present when the log statement is called. But for message type
REQUEST (3) and ACK (5) the subnet has probably already been parsed.

-- 
Peter

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users