Chapter 11. Customizing BIND logging
Enhance system visibility and security by tailoring how the BIND service records activity. By customizing logging configurations, you can track DNS queries and updates more effectively across the Identity Management (IdM) environment.
11.1. Customizing the BIND log path Copy linkLink copied to clipboard!
Direct BIND output to a specific location by defining custom logging channels in the ipa-logging-ext.conf file. This configuration controls the log file’s destination, rotation size, and the specific categories of information the server records.
Procedure
Open the
ipa-logging-ext.conffile in the/etc/named/directory and add or modify a logging channel with your file path:logging { channel ipa_custom_log { file "/var/log/named/ipa_dns_queries.log" versions 3 size 10m; severity info; print-time yes; print-severity yes; print-category yes; }; category queries { ipa_custom_log; }; category update { ipa_custom_log; }; category update-security { ipa_custom_log; }; };Restart the BIND server:
# systemctl restart named
11.2. Extending SELinux policy for BIND custom logging Copy linkLink copied to clipboard!
Grant the BIND service permission to write to custom directories by updating the SELinux policy. Assigning the named_log_t context ensures the security framework permits file creation and modification in non-standard paths.
Procedure
Create a log directory:
# mkdir -p /var/log/named# chown named:named /var/log/named# chmod 750 /var/log/namedAssign the
named_log_tSELinux context to the new directory and the log file:# semanage fcontext -a -t named_log_t "/var/log/named(/.*)?"# restorecon -Rv /var/log/namedRestart the BIND server:
# systemctl restart named
Verification
Display your custom log file:
$ tail -f /var/log/named/ipa_dns_queries.log