PowerDNS / pdns

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

Structured logging #8253

Open martenlehmann opened 5 years ago

martenlehmann commented 5 years ago

Short description

I would be great if PowerDNS would log in a structured way. This means, instead of the current free-form text in an ever growing log file, events

Expected behaviour

  1. The function signature void Logger::log(const string &msg, Urgency u) would take an additional dictionary.
  2. Calls like
    g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;

    would translate into a just very concise event message and instead provide all details using a specific, clear classification like

    {
    'context': 'axfr',
    'type': 'transaction',
    'status': 'abort',
    'domain': 'whatever.com'
    }

    via the dictionary.

Actual behaviour

Free-form log messages, which are human readable, but not really machine parsable.

Other information

There are many convincing statements about why structured logging is the preferred way out there, for example:

Usecase

At a professional scale (like Anycast setup), there's no time to watch at individual log files, even logging to syslogd is not considered state-of-the-art any longer.

Converting all free-form log messages to structured logs in PowerDNS is definitely requiring less work than asking all users to find regular expressions capturing each possible log message correctly.

omoerbeek commented 1 year ago

Done for rec