Browse Source

[1483] Logging for any queries

Michal 'vorner' Vaner 13 years ago
parent
commit
86b08bc45b
2 changed files with 16 additions and 3 deletions
  1. 7 3
      src/lib/datasrc/database.cc
  2. 9 0
      src/lib/datasrc/datasrc_messages.mes

+ 7 - 3
src/lib/datasrc/database.cc

@@ -728,7 +728,10 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
                                    DATASRC_DATABASE_FOUND_CNAME));
 
     } else if (wti != found.second.end()) {
-        if (type == RRType::ANY()) {
+        bool any(type == RRType::ANY());
+        isc::log::MessageID lid(wild ? DATASRC_DATABASE_WILDCARD_MATCH :
+                                DATASRC_DATABASE_FOUND_RRSET);
+        if (any) {
             // An ANY query, copy everything to the target instead of returning
             // directly.
             for (FoundIterator it(found.second.begin());
@@ -738,6 +741,8 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
                     target->push_back(it->second);
                 }
             }
+            lid = wild ? DATASRC_DATABASE_WILDCARD_ANY :
+                DATASRC_DATABASE_FOUND_ANY;
         }
         // Found an RR matching the query, so return it.  (Note that this
         // includes the case where we were explicitly querying for a CNAME and
@@ -745,8 +750,7 @@ DatabaseClient::Finder::findOnNameResult(const Name& name,
         // NS RRset and found it at the apex of the zone.)
         return (logAndCreateResult(name, wildname, type,
                                    wild ? WILDCARD : SUCCESS, wti->second,
-                                   wild ? DATASRC_DATABASE_WILDCARD_MATCH :
-                                   DATASRC_DATABASE_FOUND_RRSET));
+                                   lid));
     }
 
     // If we get here, we have found something at the requested name but not

+ 9 - 0
src/lib/datasrc/datasrc_messages.mes

@@ -78,6 +78,10 @@ different TTL values. This isn't allowed on the wire and is considered
 an error, so we set it to the lowest value we found (but we don't modify the
 database). The data in database should be checked and fixed.
 
+% DATASRC_DATABASE_FOUND_ANY search in datasource %1 resulted in returning all records of %2
+The data returned by the database backend contained data for the given domain
+name, so all the RRsets of the domain are returned.
+
 % DATASRC_DATABASE_FOUND_CNAME search in datasource %1 for %2/%3/%4 found CNAME, resulting in %5
 When searching the domain for a name a CNAME was found at that name.
 Even though it was not the RR type being sought, it is returned.  (The
@@ -178,6 +182,11 @@ whether the data is still valid.  The zone name, its class, and the
 underlying database name as well as the error message thrown from the
 database module are shown in the log message.
 
+% DATASRC_DATABASE_WILDCARD_ANY search in datasource %1 resulted in wildcard match type ANY on %2
+The database doesn't contain directly matching name.  When searching
+for a wildcard match, a wildcard record matching the name of the query
+containing some RRsets was found. All the RRsets of the node are returned.
+
 % DATASRC_DATABASE_WILDCARD_CANCEL_NS canceled wildcard match on %3 because %2 contains NS (data source %1)
 The database was queried to provide glue data and it didn't find direct match.
 It could create it from given wildcard, but matching wildcards is forbidden