]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do not log SKIP on each packet when PC is disabled. 8474/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 30 Oct 2019 11:14:32 +0000 (12:14 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 30 Oct 2019 11:14:32 +0000 (12:14 +0100)
pdns/common_startup.cc
pdns/tcpreceiver.cc

index 102feed64b385647661818591bfd31234eaee106..7a09bd66c85aa67fdbc8b18596f43a431484b479 100644 (file)
@@ -442,14 +442,13 @@ try
         "', do = " <<question.d_dnssecOk <<", bufsize = "<< question.getMaxReplyLen();
       if(question.d_ednsRawPacketSizeLimit > 0 && question.getMaxReplyLen() != (unsigned int)question.d_ednsRawPacketSizeLimit)
         g_log<<" ("<<question.d_ednsRawPacketSizeLimit<<")";
-      g_log<<": ";
     }
 
     if(PC.enabled() && (question.d.opcode != Opcode::Notify && question.d.opcode != Opcode::Update) && question.couldBeCached()) {
       bool haveSomething=PC.get(question, cached); // does the PacketCache recognize this question?
       if (haveSomething) {
         if(logDNSQueries)
-          g_log<<"packetcache HIT"<<endl;
+          g_log<<"packetcache HIT"<<endl;
         cached.setRemote(&question.d_remote);  // inlined
         cached.setSocket(question.getSocket());                               // inlined
         cached.d_anyLocal = question.d_anyLocal;
@@ -466,16 +465,16 @@ try
 
     if(distributor->isOverloaded()) {
       if(logDNSQueries)
-        g_log<<"Dropped query, backends are overloaded"<<endl;
+        g_log<<"Dropped query, backends are overloaded"<<endl;
       overloadDrops++;
       continue;
     }
 
     if (logDNSQueries) {
       if (PC.enabled()) {
-        g_log<<"packetcache MISS"<<endl;
+        g_log<<"packetcache MISS"<<endl;
       } else {
-        g_log<<"packetcache SKIP"<<endl;
+        g_log<<endl;
       }
     }
 
@@ -533,6 +532,10 @@ void mainthread()
    PC.setMaxEntries(::arg().asNum("max-packet-cache-entries"));
    QC.setMaxEntries(::arg().asNum("max-cache-entries"));
 
+   if (!PC.enabled() && ::arg().mustDo("log-dns-queries")) {
+     g_log<<Logger::Warning<<"Packet cache disabled, logging queries without HIT/MISS"<<endl;
+   }
+
    stubParseResolveConf();
 
    if(!::arg()["chroot"].empty()) {
index 350e4abfa3e03ad9929efd39e6d64df93dbd7930..e71c1d24f370f13388f002c0611720aa9946beee 100644 (file)
@@ -356,13 +356,13 @@ void *TCPNameserver::doConnection(void *data)
         else
           remote_text = packet->getRemote().toString();
         g_log << Logger::Notice<<"TCP Remote "<< remote_text <<" wants '" << packet->qdomain<<"|"<<packet->qtype.getName() <<
-        "', do = " <<packet->d_dnssecOk <<", bufsize = "<< packet->getMaxReplyLen()<<": ";
+        "', do = " <<packet->d_dnssecOk <<", bufsize = "<< packet->getMaxReplyLen();
       }
 
       if(PC.enabled()) {
         if(packet->couldBeCached() && PC.get(*packet, *cached)) { // short circuit - does the PacketCache recognize this question?
           if(logDNSQueries)
-            g_log<<"packetcache HIT"<<endl;
+            g_log<<"packetcache HIT"<<endl;
           cached->setRemote(&packet->d_remote);
           cached->d.id=packet->d.id;
           cached->d.rd=packet->d.rd; // copy in recursion desired bit
@@ -372,10 +372,10 @@ void *TCPNameserver::doConnection(void *data)
           continue;
         }
         if(logDNSQueries)
-            g_log<<"packetcache MISS"<<endl;
+            g_log<<"packetcache MISS"<<endl;
       } else {
         if (logDNSQueries) {
-          g_log<<"packetcache SKIP"<<endl;
+          g_log<<endl;
         }
       }
       {