Score:0

Make special query log for a certain zone bind9

in flag

How do I make special query log file from a certain zone.

While my current log config is

logging {
        channel query_logging {
                file "/var/log/named/query.log" versions 5>
                //severity debug 1;
                print-time yes;
                //print-severity yes;
                //print-category yes;
        };

        category queries {
                query_logging;
        };
};

That config is logging all queries from any zone and save it to one file. What I want is I want record for specify zone and save the log to specify file.

For example zone example.com.

So for any query line that contain example.com word will saved to specify file.

Note: my zone is encapsulated by view.

If bind can't handle it, maybe regex can do it? But how save the regex result to a file periodically? I'm wonder it will be waste CPU resource if use regex.

Score:1
cn flag

You can't.

But you could forward all logging to SyslogNG or equivalent where you have full regex capability to split a given stream in multiple files or other sinks.

PS: maybe the feature exists in other nameservers, do you have any specific reason to consider only bind?

in flag
Because nameserver I only know is ```bind```
Patrick Mevzek avatar
cn flag
dnsdist may be able to do what you need. I don't find anything in either PowerDNS or nsd.
Patrick Mevzek avatar
cn flag
Or KnotDNS, considering https://knot-resolver.readthedocs.io/en/latest/modules-policy.html#mod-policy-logging
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.