3.6. Configuring loggers in Kea
If you want to customize log settings, such as the severity level, configure loggers in Kea.
By default, Kea writes log messages to:
- The systemd journal
-
The
/var/log/messagesfiles, if thersyslogdservice is running
Prerequisites
-
The
kea-dhcp4andkea-dhcp6services are configured and running. -
You are logged in as the
rootuser.
Procedure
If you are configuring an IPv4 network:
Edit the
/etc/kea/kea-dhcp4.conffile, and add theloggersconfiguration to theDhcp4parameter. For example:{ "Dhcp4": { ..., "loggers":[ { "name":"kea-dhcp4", "output-options":[ { "output":"kea-dhcp4.log", "maxsize":104857600, "maxver":5 } ], "severity":"INFO", } ], ...The settings specified in the example are:
name-
Defines the name of the binary the
loggersettings apply to. output-
Sets the log file name in the
/var/lib/kea/directory. maxsize-
Sets the maximum size of the log file before Kea rotates it. The default value is
10240000bytes. maxver-
Sets the maximum number of rotated versions Kea will keep. Note that a
maxsizevalue less than204800bytes disables rotation. severity-
Specifies the category of messages logged. You can set one of the following values:
NONE,FATAL,ERROR,WARN,INFO, andDEBUG. Kea logs only messages of the configured severity and above.
Verify the syntax of the configuration file:
# kea-dhcp4 -t /etc/kea/kea-dhcp4.confIf the command returns
Syntax check failed, fix the errors shown in the report.Restart the
kea-dhcp4service:# systemctl restart kea-dhcp4
If you are configuring an IPv6 network:
Edit the
/etc/kea/kea-dhcp6.conffile, and add theloggersconfiguration to theDhcp6parameter, for example:{ "Dhcp6": { ..., "loggers":[ { "name":"kea-dhcp6", "output-options":[ { "output":"kea-dhcp6.log", "maxsize":104857600, "maxver":5 } ], "severity":"INFO", } ], ...Verify the syntax of the configuration file:
# kea-dhcp6 -t /etc/kea/kea-dhcp6.confIf the command returns
Syntax check failed, fix the errors shown in the report.Restart the
kea-dhcp6service:# systemctl restart kea-dhcp6
Verification
- Monitor the log file you have configured to verify that it displays messages of the expected severity.