Search code examples
dnslogfilepowerdns

Where is the PowerDNS (pdns) service log file?


I'm setting up the PowerDNS service on a Debian VM, both of the pdns-server and pdns.recursor services (in different VMs), but they're not generating any log files in the /var/log/ directory.

I checked some old VMs that have these services (created by another person), and there is a logfile for the pdns service located in /var/log/dns/pdns.log. examined the service's configuration file and searched for any settings related to the log file, but there is no difference compared to my service. In fact, there is no configuration option specifying the pdns log path.

  • My pdns-recursor service version:Oct 31 08:23:47 PowerDNS Recursor 4.4.2 (C) 2001-2020 PowerDNS.COM BV

  • Another service (has logfile) version: Oct 31 08:16:44 PowerDNS Recursor 4.7.0-alpha0.111.master.g3c02eebb5 (C) 2001-2021 PowerDNS.COM BV

However I wanna found what should I do for create that log file. What is the configuration for that? If you know, I appreciate for your help.


Solution

  • I got my answer.

    In /etc/rsyslog.conf, you can set the following for DNS logging:

    # DNS 
    local0                          /var/log/dns/pdns.log
    

    (Note: The default logging facility for PowerDNS Recursor is local0 in /etc/powerdns/recursor.conf, unless you have changed it.)

    For PowerDNS Authoritative, you must define the following in the configuration file:

    #logging
    logging-facility=0
    log-dns-details=yes
    log-dns-queries=yes
    log-timestamp=yes
    

    Afterwards, you need to create the directory and log file (as defined above), for example: /var/log/dns/pdns.log

    Finally, restart the pdns and rsyslog services with:

    sudo systemctl restart pdns.service rsyslog.service