ISC DHCP logging - different file for each subnet/pool

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

ISC DHCP logging - different file for each subnet/pool

Fleming, Tony

Can someone point me to a resource or provide a configuration example of how to log dhcp transaction (request/release/renew…) for each of the defined subnet/pools to separate files?

 

For example:

Shared-network “Faculty”

                Subnet 10.10.10.0 netmask 255.255.255.0 {

                                Option x

                                Option y

                                Range…

                }

Shared-network “Student”

                Subnet 10.10.20.0 netmask 255.255.255.0 {

                                Option x

                                Option y

                                Range …

                }

 

Ideally it would be nice to log these transaction to:

/var/log/dhcp/dhcp-faculty.log

/var/log/dhcp/dhcp-student.log

 

Any pointers are much appreciated!

 

Thank you.


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

Re: ISC DHCP logging - different file for each subnet/pool

Bill Shirley-2
You can tailor the log messages to output the subnet type.

Add the two "subnet_type"s (below in your config) and this to dhcpd.conf:
on commit {
    log (    info,
        concat (
            "Subnet-type",    subnet_type,
.
.
        )
    );
}

Then in rsyslog.conf (just after the #### RULES #### line):
if $programname == 'dhcpd' then {
    if $msg contains 'Faculty' then {
        action(type="omfile" file="/var/log/dhcpd/dhcp-faculty.log")
        #  if $syslogseverity >= 4 then stop    # warning
        #  if $syslogseverity >= 5 then stop    # notice
        if $syslogseverity >= 6 then stop     # info
    }
    if $msg contains 'Student' then {
        action(type="omfile" file="/var/log/dhcpd/dhcp-student.log")
        #  if $syslogseverity >= 4 then stop    # warning
        #  if $syslogseverity >= 5 then stop    # notice
        if $syslogseverity >= 6 then stop     # info
    }
}

This should split out the log messages.  Syslog facility 'notice' and above still go to
the regular log file.  Don't forget to restart or reload rsyslogd.

Bill

On 6/2/2017 9:11 AM, Fleming, Tony wrote:

Can someone point me to a resource or provide a configuration example of how to log dhcp transaction (request/release/renew…) for each of the defined subnet/pools to separate files?

 

For example:

Shared-network “Faculty”

                Subnet 10.10.10.0 netmask 255.255.255.0 {

            set subnet_type = "Faculty";

                                Option x

                                Option y

                                Range…

                }

Shared-network “Student”

                Subnet 10.10.20.0 netmask 255.255.255.0 {

            set subnet_type = "Student";

                                Option x

                                Option y

                                Range …

                }

 

Ideally it would be nice to log these transaction to:

/var/log/dhcp/dhcp-faculty.log

/var/log/dhcp/dhcp-student.log

 

Any pointers are much appreciated!

 

Thank you.



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


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