Skip to content
Discussion options

You must be logged in to vote

I have find some solutions from https://stackoverflow.com/questions/75107667/i-want-to-use-lua-in-pdns-recursor-to-log-the-responses-answers.

The updated code is:

pdnslog("pdns-recursor Lua script starting!", pdns.loglevels.Warning)

-- dnslog.lua for PowerDNS Recursor
-- https://doc.powerdns.com/recursor/lua-scripting/hooks.html

function log_to_pipe(line)
  local f = io.open("/var/log/pdns/dnslog.pipe", "a")
  if f then f:write(line .. "\n"); f:close() end
  pdnslog("[dnslog] " .. line, pdns.loglevels.Info)
end

function preresolve(dq)
  pdnslog("[dnslog] preresolve called", pdns.loglevels.Info)
  local event = {
    os.date("!%Y-%m-%dT%H:%M:%SZ"),
    dq.qname:toString(),
    dq.qtype,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by liudonghua123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant