PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.7k stars 908 forks source link

Allow enabling query logging in recursor using rec_control #8821

Open redrac opened 4 years ago

redrac commented 4 years ago

Short description

Enabling query logging on running recursor server

Usecase

It would be great to be able to turn query logging on and off for debug purposes on a running server without having to restart it.

Description

rec_control quiet [on|off]

ahupowerdns commented 4 years ago

rec_control trace-regex? https://doc.powerdns.com/recursor/manpages/rec_control.1.html can you check if this does what you want? Thanks.

redrac commented 4 years ago

Sure, but you get 18 lines instead of the 2 you would get for having quiet=no.

Feb 13 22:53:48 [31891] host1.example.net: Wants DNSSEC processing, auth data in query for A
Feb 13 22:53:48 [31891] host1.example.net: Looking for CNAME cache hit of 'host1.example.net|CNAME'
Feb 13 22:53:48 [31891] host1.example.net: No CNAME cache hit of 'host1.example.net|CNAME' found
Feb 13 22:53:48 [31891] host1.example.net: No cache hit for 'host1.example.net|A', trying to find an appropriate NS record
Feb 13 22:53:48 [31891] : got TA for '.'
Feb 13 22:53:48 [31891] : setting cut state for . to Secure
Feb 13 22:53:48 [31891] host1.example.net: initial validation status for host1.example.net is Indeterminate
Feb 13 22:53:48 [31891] host1.example.net: Cache consultations done, have 1 NS to contact
Feb 13 22:53:48 [31891] host1.example.net: Domain has hardcoded nameserver
Feb 13 22:53:48 [31891] host1.example.net: Resolved 'example.net' NS (empty) to: 192.168.32.3
Feb 13 22:53:48 [31891] host1.example.net: Trying IP 192.168.32.3:53, asking 'host1.example.net|A'
Feb 13 22:53:48 [31891] host1.example.net: Got 2 answers from (empty) (192.168.32.3), rcode=0 (No Error), aa=1, in 4ms
Feb 13 22:53:48 [31891] host1.example.net: accept answer 'host1.example.net|A|10.47.20.12' from 'example.net' nameservers? ttl=3600, place=1 YES! - This answer was received from a server we forward to.
Feb 13 22:53:48 [31891] host1.example.net: OPT answer '.' from 'example.net' nameservers
Feb 13 22:53:48 [31891] : got initial zone status Indeterminate for record host1.example.net
Feb 13 22:53:48 [31891] host1.example.net: determining status after receiving this packet
Feb 13 22:53:48 [31891] host1.example.net: answer is in: resolved to '10.47.20.12|A'
Feb 13 22:53:48 [31891] host1.example.net: status=got results, this level of rec

versus

Feb 13 22:57:26 1 [31905/1] question for 'host2.example.net|A' from 10.63.69.233
Feb 13 22:57:26 1 [31905/1] answer to question 'host2.example.net|A': 1 answers, 1 additional, took 1 packets, 14.549 netw ms, 15.313 tot ms, 0 throttled,
0 timeouts, 0 tcp connections, rcode=0
Habbie commented 4 years ago

Sure, but you get 18 lines instead of the 2 you would get for having quiet=no.

Ah, understood! Makes sense to me unless I'm missing some existing feature to turn quiet on and off.

omoerbeek commented 2 years ago

There is already an (undocumented) way to turn quiet on an using a signal SIGUSR2, but that also toggles query tracing. We need to decide on the exact semantics.