From: Peter van Dijk Date: Tue, 22 Jan 2013 14:12:08 +0000 (+0000) Subject: improve trace-regex and trace=fail behaviour X-Git-Tag: rec-3.5-rc1~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85ffbc535dabd93eaebcad55696647541e94637a;p=pdns improve trace-regex and trace=fail behaviour git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3072 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 3c4b7b73f..dbc29aa68 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -550,20 +550,25 @@ void startDoResolve(void *p) uint32_t minTTL=std::numeric_limits::max(); - string trace(sr.getTrace()); - if(!trace.empty()) { - vector lines; - boost::split(lines, trace, boost::is_any_of("\n")); - BOOST_FOREACH(const string& line, lines) { - if(!line.empty()) - L<rcode=RCode::ServFail; // no commit here, because no record g_stats.servFails++; } + + if(tracedQuery || pw.getHeader()->rcode == RCode::ServFail) + { + // log trace, if we have one + string trace(sr.getTrace()); + if(!trace.empty()) { + vector lines; + boost::split(lines, trace, boost::is_any_of("\n")); + BOOST_FOREACH(const string& line, lines) { + if(!line.empty()) + L<rcode=res; updateRcodeStats(res);