/* Check if the current soft memlock limit is at least the limit */
if (old_limit.rlim_cur < new_limit_size) {
SLOG(infolog("The current limit of locked memory (soft: %d, hard: %d) is too low for eBPF, trying to raise it to %d", old_limit.rlim_cur, old_limit.rlim_max, new_limit_size),
- dnsdist::logging::getTopLogger("bpf")->info("The current limit of locked memory is too low for eBPF, trying to raise it", "soft", Logging::Loggable(old_limit.rlim_cur), "hard", Logging::Loggable(old_limit.rlim_max), "target", Logging::Loggable(new_limit_size)));
+ dnsdist::logging::getTopLogger("bpf")->info(Logr::Info, "The current limit of locked memory is too low for eBPF, trying to raise it", "soft", Logging::Loggable(old_limit.rlim_cur), "hard", Logging::Loggable(old_limit.rlim_max), "target", Logging::Loggable(new_limit_size)));
struct rlimit new_limit{};
new_limit.rlim_cur = new_limit_size;
int res = computeSharedKey();
if (res != 0) {
VERBOSESLOG(infolog("Dropping encrypted query we can't compute the shared key for"),
- dnsdist::logging::getTopLogger("dnscrypt")->info("Dropping DNSCrypt-encrypted query we can't compute the shared key for"));
+ dnsdist::logging::getTopLogger("dnscrypt")->info(Logr::Info, "Dropping DNSCrypt-encrypted query we can't compute the shared key for"));
return;
}
uint16_t pos = decryptedQueryLen;
if (pos >= packet.size()) {
VERBOSESLOG(infolog("Dropping encrypted query we can't decrypt (invalid position)"),
- dnsdist::logging::getTopLogger("dnscrypt")->info("Dropping DNSCrypt-encrypted we couldn't decrypt because of an invalid position", "position", Logging::Loggable(pos), "dns.question.size", Logging::Loggable(packet.size())));
+ dnsdist::logging::getTopLogger("dnscrypt")->info(Logr::Info, "Dropping DNSCrypt-encrypted we couldn't decrypt because of an invalid position", "position", Logging::Loggable(pos), "dns.question.size", Logging::Loggable(packet.size())));
return;
}
if (pos == 0 || packet.at(pos - 1) != 0x80) {
VERBOSESLOG(infolog("Dropping encrypted query with invalid padding value"),
- dnsdist::logging::getTopLogger("dnscrypt")->info("Dropping DNSCrypt-encrypted query with invalid padding value"));
+ dnsdist::logging::getTopLogger("dnscrypt")->info(Logr::Info, "Dropping DNSCrypt-encrypted query with invalid padding value"));
return;
}
if (tcp && paddingLen > DNSCRYPT_MAX_TCP_PADDING_SIZE) {
VERBOSESLOG(infolog("Dropping encrypted query with too long padding size"),
- dnsdist::logging::getTopLogger("dnscrypt")->info("Dropping DNSCrypt-encrypted query withtoo long padding size"));
+ dnsdist::logging::getTopLogger("dnscrypt")->info(Logr::Info, "Dropping DNSCrypt-encrypted query withtoo long padding size"));
return;
}
}
catch (const std::exception& e) {
SLOG(errlog(e.what()),
- dnsdist::logging::getTopLogger("dnscrypt")->error(e.what(), "Error while generating DNSCrypt certificate"));
+ dnsdist::logging::getTopLogger("dnscrypt")->error(Logr::Error, e.what(), "Error while generating DNSCrypt certificate"));
}
sodium_memzero(providerPrivateKey.data(), providerPrivateKey.size());
}
else {
SLOG(infolog("Answer to %s for %s %s (%s) with id %u", response->ids.origRemote.toStringWithPort(), response->ids.qname.toString(), QType(response->ids.qtype).toString(), RCode::to_s(response->getHeader()->rcode), response->getHeader()->id),
- response->getLogger()->info("Logging response packet"));
+ response->getLogger()->info(Logr::Info, "Logging response packet"));
}
}
}
}
else {
VERBOSESLOG(infolog("Carbon export for %s took longer (%s us) than the configured interval (%d us)", endpoint.server.toStringWithPort(), elapsedUSec, intervalUSec),
- logger->info("Carbon export took longer than the configured interval", "dnsdist.carbon.elapsed_usec", Logging::Loggable(elapsedUSec), "dnsdist.carbon.interval_usec", Logging::Loggable(intervalUSec)));
+ logger->info(Logr::Info, "Carbon export took longer than the configured interval", "dnsdist.carbon.elapsed_usec", Logging::Loggable(elapsedUSec), "dnsdist.carbon.interval_usec", Logging::Loggable(intervalUSec)));
}
consecutiveFailures = 0;
}
consecutiveFailures++;
}
VERBOSESLOG(infolog("Run for %s - %s failed, next attempt in %d", endpoint.server.toStringWithPort(), endpoint.getOurName(), backOff),
- logger->info("Carbon export failed", "dnsdist.carbon.next_attempt_seconds", Logging::Loggable(backOff)));
+ logger->info(Logr::Info, "Carbon export failed", "dnsdist.carbon.next_attempt_seconds", Logging::Loggable(backOff)));
std::this_thread::sleep_for(std::chrono::seconds(backOff));
}
} while (true);
}
else {
SLOG(errlog("DOH bind %s is configured to use an unknown library ('%s')", bind.listen_address, frontend->d_library),
- context.logger->error(Logr::Error, "DoH frontend is configured to use an unknown library", "frontend.address", Logging::Loggable(bind.listen_address), "library", Logging::Loggable(frontend->d_library)));
+ context.logger->info(Logr::Error, "DoH frontend is configured to use an unknown library", "frontend.address", Logging::Loggable(bind.listen_address), "library", Logging::Loggable(frontend->d_library)));
return false;
}
if (ret == -1) {
int error = errno;
VERBOSESLOG(infolog("Error sending UDP response to %s: %s", dest.toStringWithPort(), stringerror(error)),
- dnsdist::logging::getTopLogger("sendfromto")->error(error, "Error sending UDP response", "client.address", Logging::Loggable(dest)));
+ dnsdist::logging::getTopLogger("sendfromto")->error(Logr::Info, error, "Error sending UDP response", "client.address", Logging::Loggable(dest)));
}
return;
}
}
catch (const std::exception& exp) {
VERBOSESLOG(infolog("Error sending UDP response from %s to %s: %s", from.toStringWithPort(), dest.toStringWithPort(), exp.what()),
- dnsdist::logging::getTopLogger("sendfromto")->error(exp.what(), "Error sending UDP response", "source.address", Logging::Loggable(from), "client.address", Logging::Loggable(dest)));
+ dnsdist::logging::getTopLogger("sendfromto")->error(Logr::Info, exp.what(), "Error sending UDP response", "source.address", Logging::Loggable(from), "client.address", Logging::Loggable(dest)));
}
}
catch (const std::exception& e) {
if (remote && !response.empty() && static_cast<size_t>(response.size()) > sizeof(dnsheader)) {
VERBOSESLOG(infolog("Backend %s sent us a response with id %d that did not parse: %s", remote->d_config.remote.toStringWithPort(), ntohs(dnsHeader->id), e.what()),
- dnsdist::logging::getTopLogger("udp-response-worker")->error(e.what(), "Received a DNS response from a backend that we could not parse", "backend.address", Logging::Loggable(remote->d_config.remote), "dns.query.id", Logging::Loggable(ntohs(dnsHeader->id))));
+ dnsdist::logging::getTopLogger("udp-response-worker")->error(Logr::Info, e.what(), "Received a DNS response from a backend that we could not parse", "backend.address", Logging::Loggable(remote->d_config.remote), "dns.query.id", Logging::Loggable(ntohs(dnsHeader->id))));
}
++dnsdist::metrics::g_stats.nonCompliantResponses;
if (remote) {
}
catch (const std::exception& e) {
VERBOSESLOG(infolog("Got an error in UDP responder thread while parsing a response from %s, id %d: %s", dss->d_config.remote.toStringWithPort(), queryId, e.what()),
- responderLogger->error(e.what(), "Got an error in UDP responder thread while parsing a response", "dns.response.id", Logging::Loggable(queryId)));
+ responderLogger->error(Logr::Info, e.what(), "Got an error in UDP responder thread while parsing a response", "dns.response.id", Logging::Loggable(queryId)));
}
}
}
catch (const std::exception& e) {
SLOG(errlog("UDP responder thread died because of exception: %s", e.what()),
- responderLogger->error(e.what(), "UDP responder thread died because of an exception"));
+ responderLogger->error(Logr::Error, e.what(), "UDP responder thread died because of an exception"));
}
catch (const PDNSException& e) {
SLOG(errlog("UDP responder thread died because of PowerDNS exception: %s", e.reason),
- responderLogger->error(e.reason, "UDP responder thread died because of a PowerDNS exception"));
+ responderLogger->error(Logr::Error, e.reason, "UDP responder thread died because of a PowerDNS exception"));
}
catch (...) {
SLOG(errlog("UDP responder thread died because of an exception: %s", "unknown"),
case DNSAction::Action::Nxdomain:
VERBOSESLOG(infolog("Query from %s turned into NXDomain because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query turned into NXDomain because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query turned into NXDomain because of a dynamic rule"));
updateBlockStats();
setRCode(RCode::NXDomain);
case DNSAction::Action::Refused:
VERBOSESLOG(infolog("Query from %s refused because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query refused because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query refused because of a dynamic rule"));
updateBlockStats();
setRCode(RCode::Refused);
case DNSAction::Action::Truncate:
if (!dnsQuestion.overTCP()) {
VERBOSESLOG(infolog("Query from %s truncated because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query truncated because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query truncated because of a dynamic rule"));
updateBlockStats();
dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [](dnsheader& header) {
header.tc = true;
}
else {
VERBOSESLOG(infolog("Query from %s for %s over TCP *not* truncated because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort(), dnsQuestion.ids.qname.toLogString()),
- dnsQuestion.getLogger()->info("Query received over TCP *not* truncated because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query received over TCP *not* truncated because of a dynamic rule"));
}
break;
case DNSAction::Action::NoRecurse:
VERBOSESLOG(infolog("Query from %s setting rd=0 because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Setting RD=0 because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Setting RD=0 because of a dynamic rule"));
updateBlockStats();
dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [](dnsheader& header) {
header.rd = false;
case DNSAction::Action::SetTag: {
if (!got->second.tagSettings) {
VERBOSESLOG(infolog("Skipping set tag dynamic block for query from %s because of missing options", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Skipping 'set tag' dynamic rule because of missing options"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Skipping 'set tag' dynamic rule because of missing options"));
break;
}
const auto& tagName = got->second.tagSettings->d_name;
const auto& tagValue = got->second.tagSettings->d_value;
VERBOSESLOG(infolog("Query from %s setting tag %s to %s because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort(), tagName, tagValue),
- dnsQuestion.getLogger()->info("Setting tag on query because of a dynamic rule", "dnsdist.tag.name", Logging::Loggable(tagName), "dnsdist.tag.value", Logging::Loggable(tagValue)));
+ dnsQuestion.getLogger()->info(Logr::Info, "Setting tag on query because of a dynamic rule", "dnsdist.tag.name", Logging::Loggable(tagName), "dnsdist.tag.value", Logging::Loggable(tagValue)));
updateBlockStats();
dnsQuestion.setTag(tagName, tagValue);
// do not return, the whole point it to set a Tag to be able to do further processing in rules
}
default:
VERBOSESLOG(infolog("Query from %s dropped because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query dropped because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query dropped because of a dynamic rule"));
updateBlockStats();
return false;
}
break;
case DNSAction::Action::Nxdomain:
VERBOSESLOG(infolog("Query from %s turned into NXDomain because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query turned into NXDomain because of a suffix-based dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query turned into NXDomain because of a suffix-based dynamic rule"));
updateBlockStats();
setRCode(RCode::NXDomain);
return true;
case DNSAction::Action::Refused:
VERBOSESLOG(infolog("Query from %s refused because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query refused because of a suffix-based dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query refused because of a suffix-based dynamic rule"));
updateBlockStats();
setRCode(RCode::Refused);
return true;
case DNSAction::Action::Truncate:
if (!dnsQuestion.overTCP()) {
VERBOSESLOG(infolog("Query from %s truncated because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query truncated because of a suffix-based dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query truncated because of a suffix-based dynamic rule"));
updateBlockStats();
dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [](dnsheader& header) {
header.tc = true;
}
else {
VERBOSESLOG(infolog("Query from %s for %s over TCP *not* truncated because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort(), dnsQuestion.ids.qname.toLogString()),
- dnsQuestion.getLogger()->info("Query received over TCP *not* truncated because of a dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query received over TCP *not* truncated because of a dynamic rule"));
}
break;
case DNSAction::Action::NoRecurse:
VERBOSESLOG(infolog("Query from %s setting rd=0 because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Setting RD=0 because of a suffix-based dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Setting RD=0 because of a suffix-based dynamic rule"));
updateBlockStats();
dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [](dnsheader& header) {
header.rd = false;
case DNSAction::Action::SetTag: {
if (!got->tagSettings) {
VERBOSESLOG(infolog("Skipping set tag dynamic block for query from %s because of missing options", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Skipping 'set tag' suffix-based dynamic rule because of missing options"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Skipping 'set tag' suffix-based dynamic rule because of missing options"));
break;
}
const auto& tagName = got->tagSettings->d_name;
const auto& tagValue = got->tagSettings->d_value;
VERBOSESLOG(infolog("Query from %s setting tag %s to %s because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort(), tagName, tagValue),
- dnsQuestion.getLogger()->info("Setting tag on query because of a suffix-based dynamic rule", "dnsdist.tag.name", Logging::Loggable(tagName), "dnsdist.tag.value", Logging::Loggable(tagValue)));
+ dnsQuestion.getLogger()->info(Logr::Info, "Setting tag on query because of a suffix-based dynamic rule", "dnsdist.tag.name", Logging::Loggable(tagName), "dnsdist.tag.value", Logging::Loggable(tagValue)));
updateBlockStats();
dnsQuestion.setTag(tagName, tagValue);
// do not return, the whole point it to set a Tag to be able to do further processing in rules
default:
updateBlockStats();
VERBOSESLOG(infolog("Query from %s dropped because of dynamic block", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Query dropped because of a suffix-based dynamic rule"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Query dropped because of a suffix-based dynamic rule"));
return false;
}
}
if (result == -1) {
int savederrno = errno;
VERBOSESLOG(infolog("Error sending request to backend %s: %s", backend->d_config.remote.toStringWithPort(), stringerror(savederrno)),
- dnsdist::logging::getTopLogger("udp-frontend")->error(savederrno, "Error sending request to the backend", "backend.address", Logging::Loggable(backend->d_config.remote)));
+ dnsdist::logging::getTopLogger("udp-frontend")->error(Logr::Info, savederrno, "Error sending request to the backend", "backend.address", Logging::Loggable(backend->d_config.remote)));
/* This might sound silly, but on Linux send() might fail with EINVAL
if the interface the socket was bound to doesn't exist anymore.
if ((msgh->msg_flags & MSG_TRUNC) != 0) {
/* message was too large for our buffer */
VERBOSESLOG(infolog("Dropping message too large for our buffer"),
- dnsdist::logging::getTopLogger("udp-query")->info("Dropping query from client that is too large for our buffer", "client.address", Logging::Loggable(remote), "destination.address", Logging::Loggable(dest), "frontend.address", Logging::Loggable(clientState.local)));
+ dnsdist::logging::getTopLogger("udp-query")->info(Logr::Info, "Dropping query from client that is too large for our buffer", "client.address", Logging::Loggable(remote), "destination.address", Logging::Loggable(dest), "frontend.address", Logging::Loggable(clientState.local)));
++clientState.nonCompliantQueries;
++dnsdist::metrics::g_stats.nonCompliantQueries;
return false;
expectProxyProtocol = clientState.d_enableProxyProtocol && expectProxyProtocolFrom(remote);
if (!dnsdist::configuration::getCurrentRuntimeConfiguration().d_ACL.match(remote) && !expectProxyProtocol) {
VERBOSESLOG(infolog("Query from %s dropped because of ACL", remote.toStringWithPort()),
- dnsdist::logging::getTopLogger("udp-query")->info("Query dropped because of ACL", "source.address", Logging::Loggable(dest)));
+ dnsdist::logging::getTopLogger("udp-query")->info(Logr::Info, "Query dropped because of ACL", "source.address", Logging::Loggable(dest)));
++dnsdist::metrics::g_stats.aclDrops;
return false;
}
if (serverPool.packetCache->get(dnsQuestion, dnsQuestion.getHeader()->id, &dnsQuestion.ids.cacheKeyNoECS, dnsQuestion.ids.subnet, *dnsQuestion.ids.dnssecOK, willBeForwardedOverUDP, allowExpired, false, true, false)) {
VERBOSESLOG(infolog("Packet cache hit for query for %s|%s from %s (%s, %d bytes)", dnsQuestion.ids.qname.toLogString(), QType(dnsQuestion.ids.qtype).toString(), dnsQuestion.ids.origRemote.toStringWithPort(), dnsQuestion.ids.protocol.toString(), dnsQuestion.getData().size()),
- dnsQuestion.getLogger()->info("Packet cache hit"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Packet cache hit"));
if (!prepareOutgoingResponse(*dnsQuestion.ids.cs, dnsQuestion, true)) {
return ProcessQueryResult::Drop;
if (!handleEDNSClientSubnet(dnsQuestion, dnsQuestion.ids.ednsAdded, dnsQuestion.ids.ecsAdded)) {
VERBOSESLOG(infolog("Dropping query from %s because we couldn't insert the ECS value", dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("Dropping query because we couldn't insert the ECS value"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Dropping query because we couldn't insert the ECS value"));
return ProcessQueryResult::Drop;
}
}
});
VERBOSESLOG(infolog("Packet cache hit for query for %s|%s from %s (%s, %d bytes)", dnsQuestion.ids.qname.toLogString(), QType(dnsQuestion.ids.qtype).toString(), dnsQuestion.ids.origRemote.toStringWithPort(), dnsQuestion.ids.protocol.toString(), dnsQuestion.getData().size()),
- dnsQuestion.getLogger()->info("Packet cache hit"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Packet cache hit"));
if (!prepareOutgoingResponse(*dnsQuestion.ids.cs, dnsQuestion, true)) {
return ProcessQueryResult::Drop;
}
VERBOSESLOG(infolog("Packet cache miss for query for %s|%s from %s (%s, %d bytes)", dnsQuestion.ids.qname.toLogString(), QType(dnsQuestion.ids.qtype).toString(), dnsQuestion.ids.origRemote.toStringWithPort(), dnsQuestion.ids.protocol.toString(), dnsQuestion.getData().size()),
- dnsQuestion.getLogger()->info("Packet cache miss"));
+ dnsQuestion.getLogger()->info(Logr::Info, "Packet cache miss"));
++dnsdist::metrics::g_stats.cacheMisses;
++dnsdist::metrics::g_stats.noPolicy;
VERBOSESLOG(infolog("%s query for %s|%s from %s, no downstream server available", servFailOnNoPolicy ? "ServFailed" : "Dropped", dnsQuestion.ids.qname.toLogString(), QType(dnsQuestion.ids.qtype).toString(), dnsQuestion.ids.origRemote.toStringWithPort()),
- dnsQuestion.getLogger()->info("No downstream server available", "dnsdist.action", Logging::Loggable(servFailOnNoPolicy ? "ServFailed" : "Dropped")));
+ dnsQuestion.getLogger()->info(Logr::Info, "No downstream server available", "dnsdist.action", Logging::Loggable(servFailOnNoPolicy ? "ServFailed" : "Dropped")));
if (servFailOnNoPolicy) {
dnsdist::self_answers::removeRecordsAndSetRCode(dnsQuestion, RCode::ServFail);
}
catch (const std::exception& e) {
VERBOSESLOG(infolog("Got an error while parsing a %s query (after applying rules) from %s, id %d: %s", (dnsQuestion.overTCP() ? "TCP" : "UDP"), dnsQuestion.ids.origRemote.toStringWithPort(), queryId, e.what()),
- dnsQuestion.getLogger()->error(e.what(), "Got an error while parsing a query (after applying rules)"));
+ dnsQuestion.getLogger()->error(Logr::Info, e.what(), "Got an error while parsing a query (after applying rules)"));
}
return ProcessQueryResult::Drop;
}
auto protocol = dnsResponse.getProtocol();
VERBOSESLOG(infolog("Handling timeout response rules for incoming protocol = %s", protocol.toString()),
- dnsResponse.getLogger()->info("Handling timeout response rules"));
+ dnsResponse.getLogger()->info(Logr::Info, "Handling timeout response rules"));
if (protocol == dnsdist::Protocol::DoH) {
#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
}
catch (const std::exception& exp) {
VERBOSESLOG(infolog("Exception while processing timeout response rules: %s", exp.what()),
- dnsResponse.getLogger()->error(exp.what(), "Exception while processing timeout response rules"));
+ dnsResponse.getLogger()->error(Logr::Info, exp.what(), "Exception while processing timeout response rules"));
}
return dnsResponse.isAsynchronous();
}
catch (const std::exception& exp) {
SLOG(warnlog("Error calling the Lua hook for Server State Change: %s", exp.what()),
- dnsdist::logging::getTopLogger("backend-state-update")->error(exp.what(), "Error calling the Lua hook for backend state change", "backend.name", Logging::Loggable(nameWithAddr)));
+ dnsdist::logging::getTopLogger("backend-state-update")->error(Logr::Warning, exp.what(), "Error calling the Lua hook for backend state change", "backend.name", Logging::Loggable(nameWithAddr)));
}
}
}
catch (const std::exception& e) {
VERBOSESLOG(infolog("Got an error while parsing a %s query from %s, id %d: %s", (dnsQuestion.overTCP() ? "TCP" : "UDP"), dnsQuestion.ids.origRemote.toStringWithPort(), queryId, e.what()),
- dnsQuestion.getLogger()->error(e.what(), "Got and error while parsing a query", "dns.question.id", Logging::Loggable(queryId)));
+ dnsQuestion.getLogger()->error(Logr::Info, e.what(), "Got and error while parsing a query", "dns.question.id", Logging::Loggable(queryId)));
}
return ProcessQueryResult::Drop;
}
}
catch (const std::exception& e) {
VERBOSESLOG(infolog("Adding proxy protocol payload to %s query from %s failed: %s", (dnsQuestion.ids.du ? "DoH" : ""), dnsQuestion.ids.origDest.toStringWithPort(), e.what()),
- dnsQuestion.getLogger()->error(e.what(), "Adding a proxy protocol payload to the query failed"));
+ dnsQuestion.getLogger()->error(Logr::Info, e.what(), "Adding a proxy protocol payload to the query failed"));
return false;
}
}
dnsQuestion.ids.forwardedOverUDP = true;
VERBOSESLOG(infolog("Got query for %s|%s from %s%s, relayed to %s%s", dnsQuestion.ids.qname.toLogString(), QType(dnsQuestion.ids.qtype).toString(), dnsQuestion.ids.origRemote.toStringWithPort(), (doh ? " (https)" : ""), downstream->getNameWithAddr(), actuallySend ? "" : " (xsk)"),
- dnsQuestion.getLogger()->info("Relayed query to backend", "backend.name", Logging::Loggable(downstream->getName()), "backend.address", Logging::Loggable(downstream->d_config.remote), "dnsdist.xsk", Logging::Loggable(!actuallySend)));
+ dnsQuestion.getLogger()->info(Logr::Info, "Relayed query to backend", "backend.name", Logging::Loggable(downstream->getName()), "backend.address", Logging::Loggable(downstream->d_config.remote), "dnsdist.xsk", Logging::Loggable(!actuallySend)));
#ifndef DISABLE_PROTOBUF
if (auto tracer = dnsQuestion.ids.getTracer(); dnsQuestion.ids.sendTraceParentToDownstreamID != 0 && tracer != nullptr) {
}
catch (const std::exception& e) {
VERBOSESLOG(infolog("Got an error in UDP question thread while parsing a query from %s, id %d: %s", ids.origRemote.toStringWithPort(), queryId, e.what()),
- dnsdist::logging::getTopLogger("udp-frontend")->error(e.what(), "Got an error in UDP question thread while parsing a query", "source.address", Logging::Loggable(ids.origRemote), "dns.question.id", Logging::Loggable(queryId)));
+ dnsdist::logging::getTopLogger("udp-frontend")->error(Logr::Info, e.what(), "Got an error in UDP question thread while parsing a query", "source.address", Logging::Loggable(ids.origRemote), "dns.question.id", Logging::Loggable(queryId)));
}
}
}
catch (const std::exception& e) {
VERBOSESLOG(infolog("Got an error in UDP question thread while parsing a query from %s, id %d: %s", ids.origRemote.toStringWithPort(), queryId, e.what()),
- dnsdist::logging::getTopLogger("udp-xsk-frontend")->error(e.what(), "Got an error in XSK UDP question thread while parsing a query", "source.address", Logging::Loggable(ids.origRemote), "dns.question.id", Logging::Loggable(queryId)));
+ dnsdist::logging::getTopLogger("udp-xsk-frontend")->error(Logr::Info, e.what(), "Got an error in XSK UDP question thread while parsing a query", "source.address", Logging::Loggable(ids.origRemote), "dns.question.id", Logging::Loggable(queryId)));
}
return false;
}
if (msgsGot <= 0) {
int savederrno = errno;
VERBOSESLOG(infolog("Getting UDP messages via recvmmsg() failed with: %s", stringerror(savederrno)),
- dnsdist::logging::getTopLogger("udp-recvmmsg-frontend")->error(savederrno, "Getting UDP messages via recvmmsg failed", "frontend.address", Logging::Loggable(clientState->local)));
+ dnsdist::logging::getTopLogger("udp-recvmmsg-frontend")->error(Logr::Info, savederrno, "Getting UDP messages via recvmmsg failed", "frontend.address", Logging::Loggable(clientState->local)));
msgsGot = 0;
continue;
}
if (sent < 0 || static_cast<unsigned int>(sent) != msgsToSend) {
int savederrno = errno;
VERBOSESLOG(infolog("Error sending responses with sendmmsg() (%d on %u): %s", sent, msgsToSend, stringerror(savederrno)),
- dnsdist::logging::getTopLogger("udp-sendmmsg-frontend")->error(savederrno, "Error sending responses with sendmmsg()", "address", Logging::Loggable(clientState->local), "dnsdist.sendmmsg.messages_sent", Logging::Loggable(sent), "dnsdist.sendmmsg.messages_to_send", Logging::Loggable(msgsToSend)));
+ dnsdist::logging::getTopLogger("udp-sendmmsg-frontend")->error(Logr::Info, savederrno, "Error sending responses with sendmmsg()", "address", Logging::Loggable(clientState->local), "dnsdist.sendmmsg.messages_sent", Logging::Loggable(sent), "dnsdist.sendmmsg.messages_to_send", Logging::Loggable(msgsToSend)));
}
}
}
}
catch (const std::exception& e) {
SLOG(errlog("UDP client thread died because of exception: %s", e.what()),
- dnsdist::logging::getTopLogger("udp-frontend")->error(e.what(), "UDP client thread died because of exception"));
+ dnsdist::logging::getTopLogger("udp-frontend")->error(Logr::Error, e.what(), "UDP client thread died because of exception"));
}
catch (const PDNSException& e) {
SLOG(errlog("UDP client thread died because of PowerDNS exception: %s", e.reason),
- dnsdist::logging::getTopLogger("udp-frontend")->error(e.reason, "UDP client thread died because of PowerDNS exception"));
+ dnsdist::logging::getTopLogger("udp-frontend")->error(Logr::Error, e.reason, "UDP client thread died because of PowerDNS exception"));
}
catch (...) {
SLOG(errlog("UDP client thread died because of an exception: unknown"),
}
catch (const std::exception& exp) {
VERBOSESLOG(infolog("Exception in the health-check thread: %s", exp.what()),
- dnsdist::logging::getTopLogger("health-check")->error(exp.what(), "Exception in the health-check thread"));
+ dnsdist::logging::getTopLogger("health-check")->error(Logr::Info, exp.what(), "Exception in the health-check thread"));
}
}
}
#ifdef IPV6_RECVPKTINFO
if (addr.isIPv6() && setsockopt(socket, IPPROTO_IPV6, IPV6_RECVPKTINFO, &one, sizeof(one)) < 0 && !s_warned_ipv6_recvpktinfo) {
SLOG(warnlog("Warning: IPV6_RECVPKTINFO setsockopt failed: %s", stringerror()),
- logger->error(stringerror(), "IPV6_RECVPKTINFO setsockopt failed", "frontend.address", Logging::Loggable(addr)));
+ logger->error(Logr::Warning, stringerror(), "IPV6_RECVPKTINFO setsockopt failed", "frontend.address", Logging::Loggable(addr)));
s_warned_ipv6_recvpktinfo = true;
}
#endif
}
catch (const std::exception& exp) {
SLOG(errlog("Unable to bind to control socket on %s: %s", local.toStringWithPort(), exp.what()),
- dnsdist::logging::getTopLogger("setup")->error(exp.what(), "Unable to bind to console control socket", "network.local.address", Logging::Loggable(local)));
+ dnsdist::logging::getTopLogger("setup")->error(Logr::Error, exp.what(), "Unable to bind to console control socket", "network.local.address", Logging::Loggable(local)));
}
}
}
catch (const std::exception& exp) {
SLOG(errlog("Unable to bind to web server socket on %s: %s", local.toStringWithPort(), exp.what()),
- dnsdist::logging::getTopLogger("setup")->error(exp.what(), "Unable to bind to web server socket", "network.local.address", Logging::Loggable(local)));
+ dnsdist::logging::getTopLogger("setup")->error(Logr::Error, exp.what(), "Unable to bind to web server socket", "network.local.address", Logging::Loggable(local)));
}
}
if (!unit->ids.selfGenerated) {
auto udiff = unit->ids.queryRealTime.udiff();
VERBOSESLOG(infolog("Got answer from %s, relayed to %s (DoH3, %d bytes), took %d us", unit->downstream->d_config.remote.toStringWithPort(), unit->ids.origRemote.toStringWithPort(), unit->response.size(), udiff),
- dnsResponse.getLogger()->info("Got answer from backend, relayed to client"));
+ dnsResponse.getLogger()->info(Logr::Info, "Got answer from backend, relayed to client"));
auto backendProtocol = unit->downstream->getProtocol();
if (backendProtocol == dnsdist::Protocol::DoUDP && unit->tcp) {
if (!dnsdist::configuration::getCurrentRuntimeConfiguration().d_ACL.match(remote)) {
VERBOSESLOG(infolog("Query from %s (DoH3) dropped because of ACL", remote.toStringWithPort()),
- dsc->df->getLogger().info("DoH3 query dropped because of ACL", "client.address", Logging::Loggable(remote)));
+ dsc->df->getLogger().info(Logr::Info, "DoH3 query dropped because of ACL", "client.address", Logging::Loggable(remote)));
++dnsdist::metrics::g_stats.aclDrops;
unit->response.clear();
}
catch (const std::exception& e) {
SLOG(errlog("Error while processing response received over DoH3: %s", e.what()),
- frontendLogger.error(e.what(), "Error while processing response received over DoH3"));
+ frontendLogger.error(Logr::Error, e.what(), "Error while processing response received over DoH3"));
}
catch (...) {
SLOG(errlog("Unspecified error while processing response received over DoH3"),
if (!unit->ids.selfGenerated) {
auto udiff = unit->ids.queryRealTime.udiff();
VERBOSESLOG(infolog("Got answer from %s, relayed to %s (quic, %d bytes), took %d us", unit->downstream->d_config.remote.toStringWithPort(), unit->ids.origRemote.toStringWithPort(), unit->response.size(), udiff),
- dnsResponse.getLogger()->info("Got answer from backend, relayed to client"));
+ dnsResponse.getLogger()->info(Logr::Info, "Got answer from backend, relayed to client"));
auto backendProtocol = unit->downstream->getProtocol();
if (backendProtocol == dnsdist::Protocol::DoUDP && unit->tcp) {
if (!dnsdist::configuration::getCurrentRuntimeConfiguration().d_ACL.match(remote)) {
VERBOSESLOG(infolog("Query from %s (DoQ) dropped because of ACL", remote.toStringWithPort()),
- dsc->df->getLogger().info("DoQ query dropped because of ACL", "client.address", Logging::Loggable(remote)));
+ dsc->df->getLogger().info(Logr::Info, "DoQ query dropped because of ACL", "client.address", Logging::Loggable(remote)));
++dnsdist::metrics::g_stats.aclDrops;
unit->response.clear();
}
catch (const std::exception& e) {
SLOG(errlog("Error while processing response received over DoQ: %s", e.what()),
- frontendLogger.error(e.what(), "Error while processing response received over DoQ"));
+ frontendLogger.error(Logr::Error, e.what(), "Error while processing response received over DoQ"));
}
catch (...) {
SLOG(errlog("Unspecified error while processing response received over DoQ"),
}
catch (const std::exception& e) {
SLOG(infolog("Error parsing the status header for stream ID %d: %s", frame->hd.stream_id, e.what()),
- dnsdist::logging::getTopLogger("nghttp2-incoming-unit-tests")->error(e.what(), "Error parsing the status header for stream", "http.stream_id", Logging::Loggable(frame->hd.stream_id)));
+ dnsdist::logging::getTopLogger("nghttp2-incoming-unit-tests")->error(Logr::Info, e.what(), "Error parsing the status header for stream", "http.stream_id", Logging::Loggable(frame->hd.stream_id)));
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
}
DNSName subdomain(target);
do {
DLOG(SLOG(g_log<<"Attempting DNAME lookup for "<<subdomain<<", d_sd.qname()="<<d_sd.qname()<<endl,
- d_slog->info("Attempting DNAME lookup", "subdomain", Logging::Loggable(subdomain), "name", Logging::Loggable(d_sd.qname()))));
+ d_slog->info(Logr::Debug, "Attempting DNAME lookup", "subdomain", Logging::Loggable(subdomain), "name", Logging::Loggable(d_sd.qname()))));
B.lookup(QType(QType::DNAME), subdomain, d_sd.domain_id, &p);
while(B.get(rr)) {
if (rr.dr.d_type == QType::LUA && !isPresigned()) {
if(!doLua) {
DLOG(SLOG(g_log<<"Have a wildcard Lua match, but not doing Lua record for this zone"<<endl,
- d_slog->info("Have a wildcard Lua match, but not doing Lua record for this zone")));
+ d_slog->info(Logr::Debug, "Have a wildcard Lua match, but not doing Lua record for this zone")));
continue;
}
DLOG(SLOG(g_log<<"Have a wildcard Lua match"<<endl,
- d_slog->info("Have a wildcard Lua match")));
+ d_slog->info(Logr::Debug, "Have a wildcard Lua match")));
auto rec=getRR<LUARecordContent>(rr.dr);
if (!rec) {
if(rec->d_type == QType::CNAME || rec->d_type == p.qtype.getCode() || (p.qtype.getCode() == QType::ANY && rec->d_type != QType::RRSIG)) {
// noCache=true;
DLOG(SLOG(g_log<<"Executing Lua: '"<<rec->getCode()<<"'"<<endl,
- d_slog->info("Executing Lua", "code", Logging::Loggable(rec->getCode()))));
+ d_slog->info(Logr::Debug, "Executing Lua", "code", Logging::Loggable(rec->getCode()))));
try {
auto recvec=luaSynth(d_slog, rec->getCode(), target, rr, d_sd.qname(), p, rec->d_type, s_LUA);
for (const auto& r : recvec) {
B.lookup(QType(QType::ANY), subdomain, d_sd.domain_id, &p);
if (B.get(rr)) {
DLOG(SLOG(g_log<<"No wildcard match, ancestor exists"<<endl,
- d_slog->info("No wildcard match, ancestor exists")));
+ d_slog->info(Logr::Debug, "No wildcard match, ancestor exists")));
B.lookupEnd();
break;
}
void PacketHandler::addNSEC3(DNSPacket& p, std::unique_ptr<DNSPacket>& r, const DNSName& target, const DNSName& wildcard, const NSEC3PARAMRecordContent& ns3rc, bool narrow, int mode)
{
DLOG(SLOG(g_log<<"addNSEC3() mode="<<mode<<" auth="<<d_sd.qname()<<" target="<<target<<" wildcard="<<wildcard<<endl,
- d_slog->info("addNSEC3()", "mode", Logging::Loggable(mode), "auth", Logging::Loggable(d_sd.qname()), "target", Logging::Loggable(target), "wildcard", Logging::Loggable(wildcard))));
+ d_slog->info(Logr::Debug, "addNSEC3()", "mode", Logging::Loggable(mode), "auth", Logging::Loggable(d_sd.qname()), "target", Logging::Loggable(target), "wildcard", Logging::Loggable(wildcard))));
if (d_sd.db == nullptr) {
if(!B.getSOAUncached(d_sd.zonename, d_sd)) {
DLOG(SLOG(g_log<<"Could not get SOA for domain"<<endl,
- d_slog->info("Could not get SOA for domain")));
+ d_slog->info(Logr::Debug, "Could not get SOA for domain")));
return;
}
}
unhashed=(mode == 0 || mode == 1 || mode == 5) ? target : closest;
hashed=hashQNameWithSalt(ns3rc, unhashed);
DLOG(SLOG(g_log<<"1 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl,
- d_slog->info("1 hash", "hash", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
+ d_slog->info(Logr::Debug, "1 hash", "hash", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
getNSEC3Hashes(narrow, hashed, false, unhashed, before, after, mode);
if (((mode == 0 && ns3rc.d_flags) || mode == 1) && (hashed != before)) {
DLOG(SLOG(g_log<<"No matching NSEC3, do closest (provable) encloser"<<endl,
- d_slog->info("No matching NSEC3, do closest (provable) encloser")));
+ d_slog->info(Logr::Debug, "No matching NSEC3, do closest (provable) encloser")));
bool doBreak = false;
DNSZoneRecord rr;
unhashed=closest;
hashed=hashQNameWithSalt(ns3rc, unhashed);
DLOG(SLOG(g_log<<"1 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl,
- d_slog->info("1 hash", "hash", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
+ d_slog->info(Logr::Debug, "1 hash", "hash", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
getNSEC3Hashes(narrow, hashed, false, unhashed, before, after);
}
if (!after.empty()) {
DLOG(SLOG(g_log<<"Done calling for matching, hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl,
- d_slog->info("Done calling for matching", "hash", Logging::Loggable(toBase32Hex(hashed)), "before", Logging::Loggable(toBase32Hex(before)), "after", Logging::Loggable(toBase32Hex(after)))));
+ d_slog->info(Logr::Debug, "Done calling for matching", "hash", Logging::Loggable(toBase32Hex(hashed)), "before", Logging::Loggable(toBase32Hex(before)), "after", Logging::Loggable(toBase32Hex(after)))));
emitNSEC3(p, r, ns3rc, unhashed, before, after, mode);
}
}
hashed=hashQNameWithSalt(ns3rc, unhashed);
DLOG(SLOG(g_log<<"2 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl,
- d_slog->info("2 hash", "hash", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
+ d_slog->info(Logr::Debug, "2 hash", "hash", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
getNSEC3Hashes(narrow, hashed, true, unhashed, before, after);
DLOG(SLOG(g_log<<"Done calling for covering, hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl,
- d_slog->info("Done calling for covering", "hash", Logging::Loggable(toBase32Hex(hashed)), "before", Logging::Loggable(toBase32Hex(before)), "after", Logging::Loggable(toBase32Hex(after)))));
+ d_slog->info(Logr::Debug, "Done calling for covering", "hash", Logging::Loggable(toBase32Hex(hashed)), "before", Logging::Loggable(toBase32Hex(before)), "after", Logging::Loggable(toBase32Hex(after)))));
emitNSEC3(p, r, ns3rc, unhashed, before, after, mode);
}
hashed=hashQNameWithSalt(ns3rc, unhashed);
DLOG(SLOG(g_log<<"3 hash: "<<toBase32Hex(hashed)<<" "<<unhashed<<endl,
- d_slog->info("3 hash", "hashed", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
+ d_slog->info(Logr::Debug, "3 hash", "hashed", Logging::Loggable(toBase32Hex(hashed)), "unhashed", Logging::Loggable(unhashed))));
getNSEC3Hashes(narrow, hashed, (mode != 2), unhashed, before, after);
DLOG(SLOG(g_log<<"Done calling for '*', hashed: '"<<toBase32Hex(hashed)<<"' before='"<<toBase32Hex(before)<<"', after='"<<toBase32Hex(after)<<"'"<<endl,
- d_slog->info("Done calling for '*'", "hash", Logging::Loggable(toBase32Hex(hashed)), "before", Logging::Loggable(toBase32Hex(before)), "after", Logging::Loggable(toBase32Hex(after)))));
+ d_slog->info(Logr::Debug, "Done calling for '*'", "hash", Logging::Loggable(toBase32Hex(hashed)), "before", Logging::Loggable(toBase32Hex(before)), "after", Logging::Loggable(toBase32Hex(after)))));
emitNSEC3(p, r, ns3rc, unhashed, before, after, mode);
}
}
void PacketHandler::addNSEC(DNSPacket& /* p */, std::unique_ptr<DNSPacket>& r, const DNSName& target, const DNSName& wildcard, int mode)
{
DLOG(SLOG(g_log<<"addNSEC() mode="<<mode<<" auth="<<d_sd.qname()<<" target="<<target<<" wildcard="<<wildcard<<endl,
- d_slog->info("addNSEC()", "mode", Logging::Loggable(mode), "auth", Logging::Loggable(d_sd.qname()), "target", Logging::Loggable(target), "wildcard", Logging::Loggable(wildcard))));
+ d_slog->info(Logr::Debug, "addNSEC()", "mode", Logging::Loggable(mode), "auth", Logging::Loggable(d_sd.qname()), "target", Logging::Loggable(target), "wildcard", Logging::Loggable(wildcard))));
if (d_sd.db == nullptr) {
if(!B.getSOAUncached(d_sd.zonename, d_sd)) {
DLOG(SLOG(g_log<<"Could not get SOA for domain"<<endl,
- d_slog->info("Could not get SOA for domain")));
+ d_slog->info(Logr::Debug, "Could not get SOA for domain")));
return;
}
}
if(rrset.empty()) {
DLOG(SLOG(g_log<<"Wildcard matched something, but not of the correct type"<<endl,
- d_slog->info("Wildcard matched something, but not of the correct type")));
+ d_slog->info(Logr::Debug, "Wildcard matched something, but not of the correct type")));
nodata=true;
}
else {
}
DLOG(SLOG(g_log<<"Checking for referrals first, unless this is a DS query"<<endl,
- d_slog->info("Checking for referrals first, unless this is a DS query")));
+ d_slog->info(Logr::Debug, "Checking for referrals first, unless this is a DS query")));
if(pkt.qtype.getCode() != QType::DS && tryReferral(pkt, state.r, state.target, retargeted)) {
return true;
}
DLOG(SLOG(g_log<<"Got no referrals, trying ANY"<<endl,
- d_slog->info("Got no referrals, trying ANY")));
+ d_slog->info(Logr::Debug, "Got no referrals, trying ANY")));
#ifdef HAVE_LUA_RECORDS
bool doLua = doLuaRecords();
}
DLOG(SLOG(g_log<<"After first ANY query for '"<<state.target<<"', id="<<d_sd.domain_id<<": weDone="<<weDone<<", weHaveUnauth="<<weHaveUnauth<<", weRedirected="<<weRedirected<<", haveAlias='"<<haveAlias<<"'"<<endl,
- d_slog->info("After first ANY query", "query", Logging::Loggable(state.target), "id", Logging::Loggable(d_sd.domain_id), "weDone", Logging::Loggable(weDone), "weHaveUnauth", Logging::Loggable(weHaveUnauth), "weRedirected", Logging::Loggable(weRedirected), "haveAlias", Logging::Loggable(haveAlias))));
+ d_slog->info(Logr::Debug, "After first ANY query", "query", Logging::Loggable(state.target), "id", Logging::Loggable(d_sd.domain_id), "weDone", Logging::Loggable(weDone), "weHaveUnauth", Logging::Loggable(weHaveUnauth), "weRedirected", Logging::Loggable(weRedirected), "haveAlias", Logging::Loggable(haveAlias))));
if(pkt.qtype.getCode() == QType::DS && weHaveUnauth && !weDone && !weRedirected) {
DLOG(SLOG(g_log<<"Q for DS of a name for which we do have NS, but for which we don't have DS; need to provide an AUTH answer that shows we don't"<<endl,
- d_slog->info("Query for DS of a name for which we do have NS, but don't have any DS; need to provide an AUTH answer that shows this")));
+ d_slog->info(Logr::Debug, "Query for DS of a name for which we do have NS, but don't have any DS; need to provide an AUTH answer that shows this")));
makeNOError(pkt, state.r, state.target, DNSName(), 1);
return true;
}
// referral for DS query
if(pkt.qtype.getCode() == QType::DS) {
DLOG(SLOG(g_log<<"Qtype is DS"<<endl,
- d_slog->info("QType is DS")));
+ d_slog->info(Logr::Debug, "QType is DS")));
bool doReferral = true;
if(d_dk.doesDNSSEC()) {
for(auto& loopRR: rrset) {
}
if(doReferral) {
DLOG(SLOG(g_log<<"DS query found no direct result, trying referral now"<<endl,
- d_slog->info("DS query found no direct result, trying referral now")));
+ d_slog->info(Logr::Debug, "DS query found no direct result, trying referral now")));
if(tryReferral(pkt, state.r, state.target, retargeted)) {
DLOG(SLOG(g_log<<"Got referral for DS query"<<endl,
- d_slog->info("Got referral for DS query")));
+ d_slog->info(Logr::Debug, "Got referral for DS query")));
return true;
}
}
}
else if(weHaveUnauth) {
DLOG(SLOG(g_log<<"Have unauth data, so need to hunt for best NS records"<<endl,
- d_slog->info("Have unauth data, searching for best NS record")));
+ d_slog->info(Logr::Debug, "Have unauth data, searching for best NS record")));
if (tryReferral(pkt, state.r, state.target, retargeted)) {
return true;
}
}
else {
DLOG(SLOG(g_log<<"Have some data, but not the right data"<<endl,
- d_slog->info("Have some data, but not the right data")));
+ d_slog->info(Logr::Debug, "Have some data, but not the right data")));
makeNOError(pkt, state.r, state.target, DNSName(), 0);
}
return true;
std::rethrow_if_nested(e);
}
catch (const std::exception& ne) {
- resolver.d_slog->error(Logr::Error, ne.what(), "Nested exception in resolver context", Logging::Loggable("std::exception"));
+ resolver.d_slog->error(Logr::Error, ne.what(), "Nested exception in resolver context", "exception", Logging::Loggable("std::exception"));
}
catch (...) {
;
}
catch (const MOADNSException& moadnsexception) {
if (g_logCommonErrors) {
- g_slogudpin->error(moadnsexception.what(), "Error parsing a query packet for tag determination", "qname", Logging::Loggable(qname), "exception", Logging::Loggable("MOADNSException"));
+ g_slogudpin->error(Logr::Error, moadnsexception.what(), "Error parsing a query packet for tag determination", "qname", Logging::Loggable(qname), "exception", Logging::Loggable("MOADNSException"));
}
}
catch (const std::exception& stdException) {
lci.d_slog->error(Logr::Error, e.what(), "Exception configuring 'rpzPrimary'", "exception", Logging::Loggable("std::exception"));
}
catch (const PDNSException& e) {
- lci.d_slog->error(Logr::Error, e.reason, "Exception configuring 'rpzPrimary'", Logging::Loggable("PDNSException"));
+ lci.d_slog->error(Logr::Error, e.reason, "Exception configuring 'rpzPrimary'", "exception", Logging::Loggable("PDNSException"));
}
}
parseProtobufOptions(vars, lci.outgoingProtobufExportConfig);
}
catch (std::exception& e) {
- lci.d_slog->error(Logr::Error, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("std::exception"));
+ lci.d_slog->error(Logr::Error, e.what(), "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- lci.d_slog->error(Logr::Error, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("PDNSException"));
+ lci.d_slog->error(Logr::Error, e.reason, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
parseFrameStreamOptions(vars, lci.frameStreamExportConfig);
}
catch (std::exception& e) {
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("std::exception"));
+ lci.d_slog->error(Logr::Error, e.what(), "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("PDNSException"));
+ lci.d_slog->error(Logr::Error, e.reason, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
- lci.d_slog->info(Logr::Error, "Only one dnstapFrameStreamServer() directive can be configured", "existing", Logging::Loggable(lci.frameStreamExportConfig.servers.at(0)));
+ lci.d_slog->info(Logr::Error, "Only one dnstapFrameStreamServer() directive can be configured", "existing", Logging::Loggable(lci.frameStreamExportConfig.servers.at(0)));
}
});
// NOLINTNEXTLINE(performance-unnecessary-value-param) Lua wrapper does not handle optional &
parseFrameStreamOptions(vars, lci.nodFrameStreamExportConfig);
}
catch (std::exception& e) {
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("std::exception"));
+ lci.d_slog->error(Logr::Error, e.what(), "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("PDNSException"));
+ lci.d_slog->error(Logr::Error, e.reason, "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
- lci.d_slog->info(Logr::Error, "Only one dnstapNODFrameStreamServer() directive can be configured", "existing", Logging::Loggable(lci.nodFrameStreamExportConfig.servers.at(0)));
+ lci.d_slog->info(Logr::Error, "Only one dnstapNODFrameStreamServer() directive can be configured", "existing", Logging::Loggable(lci.nodFrameStreamExportConfig.servers.at(0)));
}
});
#endif /* HAVE_FSTRM */
}
catch (const MOADNSException& moadnsexception) {
if (g_logCommonErrors) {
- g_slog->withName("runtime")->error(moadnsexception.what(), "PIPE function created an exception", "exception", Logging::Loggable("MOADNSException"));
+ g_slog->withName("runtime")->error(Logr::Error, moadnsexception.what(), "PIPE function created an exception", "exception", Logging::Loggable("MOADNSException"));
}
}
catch (const std::exception& stdException) {
if (config == "check") {
try {
if (!::arg().file(configname)) {
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
+ startupLog->error(Logr::Error, "No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
return {1, true};
}
::arg().parse(argc, argv);
return {0, true};
}
catch (const ArgException& argException) {
- startupLog->error("Cannot parse configuration", "Unable to parse configuration file", "config_file", Logging::Loggable(configname), "reason", Logging::Loggable(argException.reason));
+ startupLog->error(Logr::Error, "Cannot parse configuration", "Unable to parse configuration file", "config_file", Logging::Loggable(configname), "reason", Logging::Loggable(argException.reason));
return {1, true};
}
}
}
else if (config == "diff") {
if (!::arg().laxFile(configname)) {
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
+ startupLog->error(Logr::Error, "No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
return {1, true};
}
::arg().laxParse(argc, argv);
}
else {
if (!::arg().laxFile(configname)) {
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
+ startupLog->error(Logr::Error, "No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
return {1, true};
}
::arg().laxParse(argc, argv);
return ret;
}
if (!::arg().file(configname)) {
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
+ startupLog->error(Logr::Error, "No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
}
else {
if (!::arg().mustDo("enable-old-settings")) {
log->error(Logr::Error, e.what(), "Exception processing cache dump");
}
catch (...) {
- log->error(Logr::Error, "Other exception processing cache dump");
+ log->info(Logr::Error, "Other exception processing cache dump");
}
return 0;
}
ofconf << yaml << endl;
ofconf.close();
if (ofconf.bad()) {
- log->error(Logr::Error, "Error writing YAML", "to", Logging::Loggable(tmpfilename));
+ log->info(Logr::Error, "Error writing YAML", "to", Logging::Loggable(tmpfilename));
unlink(tmpfilename.c_str());
throw runtime_error("YAML Conversion");
}
ifconf.close();
ofconf.close();
if (ofconf.bad()) {
- log->error(Logr::Error, "Error writing YAML", "to", Logging::Loggable(dst));
+ log->info(Logr::Error, "Error writing YAML", "to", Logging::Loggable(dst));
throw runtime_error("YAML Conversion");
}
}
ttd += d_ttl;
}
else {
- log->error(Logr::Error, "Name did not resolve", "name", Logging::Loggable(entry.first));
+ log->info(Logr::Error, "Name did not resolve", "name", Logging::Loggable(entry.first));
}
if (newAddress != entry.second.d_address) {
log->info(Logr::Debug, "Name resolved to new address",
address.setPort(port);
return address;
}
- log->error(Logr::Error, "Could not resolve name", "name", Logging::Loggable(str));
+ log->info(Logr::Error, "Could not resolve name", "name", Logging::Loggable(str));
throw PDNSException("Could not resolve " + str);
}
}
}
catch (const MOADNSException& moadnsexception) {
if (g_logCommonErrors) {
- g_slogtcpin->error(moadnsexception.what(), "Error parsing a query packet for tag determination", "qname", Logging::Loggable(qname), "exception", Logging::Loggable("MOADNSException"));
+ g_slogtcpin->error(Logr::Error, moadnsexception.what(), "Error parsing a query packet for tag determination", "qname", Logging::Loggable(qname), "exception", Logging::Loggable("MOADNSException"));
}
}
catch (const std::exception& stdException) {
oldZone = g_luaconfs.getLocal()->catalogzones.at(params.zoneIdx).d_catz;
}
if (!oldZone) {
- logger->error(Logr::Error, "Unable to retrieve catalog zone from configuration", "index", Logging::Loggable(params.zoneIdx));
+ logger->info(Logr::Error, "Unable to retrieve catalog zone from configuration", "index", Logging::Loggable(params.zoneIdx));
return;
}
log->error(Logr::Error, e.what(), "Exception processing cache dump");
}
catch (...) {
- log->error(Logr::Error, "Other exception processing cache dump");
+ log->info(Logr::Error, "Other exception processing cache dump");
}
return 0;
}
string fname = ::arg()["etc-hosts-file"];
ifstream ifs(fname);
if (!ifs) {
- log->error(Logr::Warning, "Could not open file for reading", "file", Logging::Loggable(fname));
+ log->info(Logr::Warning, "Could not open file for reading", "file", Logging::Loggable(fname));
return;
}
vector<string> parts;
/* we can _never_ modify this zone directly, we need to do a full copy then replace the existing zone */
std::shared_ptr<DNSFilterEngine::Zone> oldZone = g_luaconfs.getLocal()->dfe.getZone(params.zoneXFRParams.zoneIdx);
if (!oldZone) {
- logger->error(Logr::Error, "Unable to retrieve RPZ zone from configuration", "index", Logging::Loggable(params.zoneXFRParams.zoneIdx));
+ logger->info(Logr::Error, "Unable to retrieve RPZ zone from configuration", "index", Logging::Loggable(params.zoneXFRParams.zoneIdx));
return;
}
{
if (d_func == nullptr) {
auto log = g_slog->withName("taskq")->withValues("name", Logging::Loggable(d_qname), "qtype", Logging::Loggable(QType(d_qtype).toString()));
- log->error(Logr::Debug, "null task");
+ log->info(Logr::Debug, "null task");
return false;
}
struct timeval now{};
g_slog->withName("protobuf")->error(Logr::Error, e.what(), "Exception while connecting to remote logger", "address", Logging::Loggable(d_remote)));
#else
SLOG(warnlog("Error connecting to remote logger %s: %s", d_remote.toStringWithPort(), e.what()),
- dnsdist::logging::getTopLogger("protobuf")->error(e.what(), "Exception while connecting to remote logger", "address", Logging::Loggable(d_remote))
+ dnsdist::logging::getTopLogger("protobuf")->error(Logr::Error, e.what(), "Exception while connecting to remote logger", "address", Logging::Loggable(d_remote))
);
#endif
g_slog->withName("protobuf")->error(Logr::Error, e.what(), "Remote Logger's maintenance thread died"));
#else
SLOG(errlog("Remote Logger's maintenance thread died on: %s", e.what()),
- dnsdist::logging::getTopLogger("protobuf")->error(e.what(), "Remote Logger's maintenance thread died")
+ dnsdist::logging::getTopLogger("protobuf")->error(Logr::Error, e.what(), "Remote Logger's maintenance thread died")
);
#endif
}