pdns icon indicating copy to clipboard operation
pdns copied to clipboard

dnsdist: Add config nob to add logging of "Drops" (queries)

Open pettai opened this issue 7 months ago • 4 comments

  • Program: dnsdist
  • Issue type: Feature request

Short description

Add config nob for logging of "Drops" (reported in dnsdist stats)

Usecase

Per old thread https://mailman.powerdns.com/pipermail/pdns-users/2015-December/023910.html Drops can currently only be logged / looked at using verbose logging. But running dnsdist in verbose mode in production would produce too much information (mainly working queries) and unnecessary amount of logs.

Description

"Keep the log amount as low as possible, and just log (all) errors"

What I've seen during verbose output, most reported Drops are queries against non funct domains

dnsdist[3531804]: Had a downstream timeout from [::1]:8053 (workeripv6) for query for 111.199.123.112.in-addr.arpa|PTR from 10.100.0.1:27149
dnsdist[3531804]: Had a downstream timeout from [::1]:8053 (workeripv6) for query for contact.id|A from 10.100.0.1::39975

Add a knob for logging the queries that times out? (as the messages above)

pettai avatar May 07 '25 15:05 pettai

I was going to suggest addTimeoutResponseAction and LogResponseAction but it tries to access the (presumably empty) header. Maybe that is an easy fix though.

but otherwise you can do this with Lua in 2.0.0 and forward:

local function foo(dq)
	infolog(dq.qname:toString())
	return DNSResponseAction.None
end

addTimeoutResponseAction(AllRule(),LuaResponseAction(foo))

phonedph1 avatar May 07 '25 19:05 phonedph1

Aha, thanks for the pointer! I'll give it a try

pettai avatar May 08 '25 07:05 pettai

I was going to suggest addTimeoutResponseAction and LogResponseAction but it tries to access the (presumably empty) header. Maybe that is an easy fix though.

but otherwise you can do this with Lua in 2.0.0 and forward:

local function foo(dq) infolog(dq.qname:toString()) return DNSResponseAction.None end

addTimeoutResponseAction(AllRule(),LuaResponseAction(foo))

dnsdist-2.0.0~alpha1 doesn't seem to like this configuration stanza unfortunately

# dnsdist --check-config
Fatal Lua error: [string "chunk"]:107: attempt to call global 'addTimeoutResponseAction' (a nil value)
stack traceback:
	[string "chunk"]:107: in main chunk

pettai avatar May 08 '25 07:05 pettai

might have been slightly after the alpha was out :)

phonedph1 avatar May 08 '25 21:05 phonedph1

Closing this since 2.0.0 has been released.

rgacogne avatar Nov 28 '25 08:11 rgacogne