}
}
catch(std::exception& e) {
- SLOG(g_log <<Logger::Error<<e.what()<<endl,
- g_slog->withName("lua")->error(Logr::Error, e.what(), "Error in call to DNSSuffixMatchGroup:add"));
+ g_slog->withName("lua")->error(Logr::Error, e.what(), "Error in call to DNSSuffixMatchGroup:add");
}
}
);
static void warnDrop(const RecursorLua4::DNSQuestion& dnsQuestion)
{
if (dnsQuestion.rcode == -2) {
- SLOG(g_log << Logger::Error << "Returning -2 (pdns.DROP) is not supported anymore, see https://docs.powerdns.com/recursor/lua-scripting/hooks.html#hooksemantics" << endl,
- g_slog->withName("lua")->info(Logr::Error, "Returning -2 (pdns.DROP) is not supported anymore, see https://docs.powerdns.com/recursor/lua-scripting/hooks.html#hooksemantics"));
+ g_slog->withName("lua")->info(Logr::Error, "Returning -2 (pdns.DROP) is not supported anymore, see https://docs.powerdns.com/recursor/lua-scripting/hooks.html#hooksemantics");
// We *could* set policy here, but that would also mean interfering with rcode and the return code of the hook.
// So leave it at the error message.
}
// coverity[auto_causes_copy] not copying produces a dangling ref
const auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>>(dnsQuestion.udpCallback).get_value_or(nullptr);
if (!cbFunc) {
- SLOG(g_log << Logger::Error << "Attempted callback for Lua UDP Query/Response which could not be found" << endl,
- g_slog->withName("lua")->info(Logr::Error, "Attempted callback for Lua UDP Query/Response which could not be found"));
+ g_slog->withName("lua")->info(Logr::Error, "Attempted callback for Lua UDP Query/Response which could not be found");
return false;
}
bool result = cbFunc(&dnsQuestion);
break;
case RemoteLoggerInterface::Result::PipeFull: {
const auto& msg = RemoteLoggerInterface::toErrorString(ret);
- SLOG(g_log << Logger::Debug << rli.name() << ": " << msg << std::endl,
- g_slog->withName(rli.name())->info(Logr::Debug, msg));
+ g_slog->withName(rli.name())->info(Logr::Debug, msg);
break;
}
case RemoteLoggerInterface::Result::TooLarge: {
const auto& msg = RemoteLoggerInterface::toErrorString(ret);
- SLOG(g_log << Logger::Notice << rli.name() << ": " << msg << endl,
- g_slog->withName(rli.name())->info(Logr::Debug, msg));
+ g_slog->withName(rli.name())->info(Logr::Debug, msg);
break;
}
case RemoteLoggerInterface::Result::OtherError: {
const auto& msg = RemoteLoggerInterface::toErrorString(ret);
- SLOG(g_log << Logger::Warning << rli.name() << ": " << msg << std::endl,
- g_slog->withName(rli.name())->info(Logr::Warning, msg));
+ g_slog->withName(rli.name())->info(Logr::Warning, msg);
break;
}
}
// tlsParams.d_caStore
tlsCtx = getTLSContext(tlsParams);
if (tlsCtx == nullptr) {
- SLOG(g_log << Logger::Error << "DoT to " << ip << " requested but not available" << endl,
- g_slogout->info(Logr::Error, "DoT requested but not available", "server", Logging::Loggable(ip)));
+ g_slogout->info(Logr::Error, "DoT requested but not available", "server", Logging::Loggable(ip));
dnsOverTLS = false;
}
}
if (domain != mdp.d_qname) {
if (!mdp.d_qname.empty() && domain.toString().find((char)0) == string::npos /* ugly */) { // embedded nulls are too noisy, plus empty domains are too
- SLOG(g_log << Logger::Notice << "Packet purporting to come from remote server " << address.toString() << " contained wrong answer: '" << domain << "' != '" << mdp.d_qname << "'" << endl,
- g_slogout->info(Logr::Notice, "Packet purporting to come from remote server contained wrong answer",
- "server", Logging::Loggable(address),
- "qname", Logging::Loggable(domain),
- "onwire", Logging::Loggable(mdp.d_qname)));
+ g_slogout->info(Logr::Notice, "Packet purporting to come from remote server contained wrong answer",
+ "server", Logging::Loggable(address),
+ "qname", Logging::Loggable(domain),
+ "onwire", Logging::Loggable(mdp.d_qname));
}
// unexpected count has already been done @ pdns_recursor.cc
goto out;
}
catch (const std::exception& mde) {
if (::arg().mustDo("log-common-errors")) {
- SLOG(g_log << Logger::Notice << "Unable to parse packet from remote server " << address.toString() << ": " << mde.what() << endl,
- g_slogout->error(Logr::Notice, mde.what(), "Unable to parse packet from remote server", "server", Logging::Loggable(address),
- "exception", Logging::Loggable("std::exception")));
+ g_slogout->error(Logr::Notice, mde.what(), "Unable to parse packet from remote server", "server", Logging::Loggable(address),
+ "exception", Logging::Loggable("std::exception"));
}
lwr->d_rcode = RCode::FormErr;
return LWResult::Result::Success; // success - oddly enough
}
catch (...) {
- SLOG(g_log << Logger::Notice << "Unknown error parsing packet from remote server" << endl,
- g_slogout->info(Logr::Notice, "Unknown error parsing packet from remote server", "server", Logging::Loggable(address)));
+ g_slogout->info(Logr::Notice, "Unknown error parsing packet from remote server", "server", Logging::Loggable(address));
}
t_Counters.at(rec::Counter::serverParseError)++;
std::ifstream infile;
try {
infile.open(filename, std::ios::in | std::ios::binary);
- SLOG(g_log << Logger::Warning << "Found SBF file " << filename << endl,
- log->info(Logr::Warning, "Found SBF File", "file", Logging::Loggable(filename)));
+ log->info(Logr::Warning, "Found SBF File", "file", Logging::Loggable(filename));
// read the file into the sbf
d_sbf.lock()->restore(infile);
infile.close();
catch (const std::runtime_error& e) {
infile.close();
filesystem::remove(newest_file);
- SLOG(g_log << Logger::Warning << "NODDB init: Cannot parse file: " << filename << ": " << e.what() << "; removed" << endl,
- log->error(Logr::Warning, e.what(), "NODDB init: Cannot parse file, removed", "file", Logging::Loggable(filename)));
+ log->error(Logr::Warning, e.what(), "NODDB init: Cannot parse file, removed", "file", Logging::Loggable(filename));
}
}
}
}
catch (const filesystem::filesystem_error& e) {
- SLOG(g_log << Logger::Warning << "NODDB init failed: " << e.what() << endl,
- log->error(Logr::Warning, e.what(), "NODDB init failed", "exception", Logging::Loggable("filesystem::filesystem_error")));
+ log->error(Logr::Warning, e.what(), "NODDB init failed", "exception", Logging::Loggable("filesystem::filesystem_error"));
return false;
}
}
filesystem::rename(ftmp, file);
}
catch (const std::runtime_error& e) {
- SLOG(g_log << Logger::Warning << "NODDB snapshot: Cannot rename file: " << e.what() << endl,
- log->error(Logr::Warning, e.what(), "NODDB snapshot: Cannot rename file", "exception", Logging::Loggable("std::runtime_error")));
+ log->error(Logr::Warning, e.what(), "NODDB snapshot: Cannot rename file", "exception", Logging::Loggable("std::runtime_error"));
filesystem::remove(ftmp);
throw;
}
return true;
}
catch (const std::runtime_error& e) {
- SLOG(g_log << Logger::Warning << "NODDB snapshot: Cannot write file: " << e.what() << endl,
- log->error(Logr::Warning, e.what(), "NODDB snapshot: Cannot write file", "exception", Logging::Loggable("std::runtime_error")));
+ log->error(Logr::Warning, e.what(), "NODDB snapshot: Cannot write file", "exception", Logging::Loggable("std::runtime_error"));
}
}
else {
- SLOG(g_log << Logger::Warning << "NODDB snapshot: Cannot write file: " << file.string() << endl,
- log->info(Logr::Warning, "NODDB snapshot: Cannot write file", "file", Logging::Loggable(file.string())));
+ log->info(Logr::Warning, "NODDB snapshot: Cannot write file", "file", Logging::Loggable(file.string()));
}
}
return false;
closesocket(*fileDesc);
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error closing UDP socket after connect() failed: " << e.reason << endl,
- g_slogout->error(Logr::Error, e.reason, "Error closing UDP socket after connect() failed", "exception", Logging::Loggable("PDNSException")));
+ g_slogout->error(Logr::Error, e.reason, "Error closing UDP socket after connect() failed", "exception", Logging::Loggable("PDNSException"));
}
if (err == ENETUNREACH) { // Seth "My Interfaces Are Like A Yo Yo" Arnold special
closesocket(fileDesc);
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error closing returned UDP socket: " << e.reason << endl,
- g_slogout->error(Logr::Error, e.reason, "Error closing returned UDP socket", "exception", Logging::Loggable("PDNSException")));
+ g_slogout->error(Logr::Error, e.reason, "Error closing returned UDP socket", "exception", Logging::Loggable("PDNSException"));
}
--d_numsocks;
ssize_t ret = recvfrom(fileDesc, resp.data(), resp.size(), 0, reinterpret_cast<sockaddr*>(&fromaddr), &addrlen); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
if (fromaddr != pident->remote) {
- SLOG(g_log << Logger::Notice << "Response received from the wrong remote host (" << fromaddr.toStringWithPort() << " instead of " << pident->remote.toStringWithPort() << "), discarding" << endl,
- g_slog->withName("lua")->info(Logr::Notice, "Response received from the wrong remote host. discarding", "method", Logging::Loggable("GenUDPQueryResponse"), "fromaddr", Logging::Loggable(fromaddr), "expected", Logging::Loggable(pident->remote)));
+ g_slog->withName("lua")->info(Logr::Notice, "Response received from the wrong remote host. discarding", "method", Logging::Loggable("GenUDPQueryResponse"), "fromaddr", Logging::Loggable(fromaddr), "expected", Logging::Loggable(pident->remote));
}
t_fdm->removeReadFD(fileDesc);
if (nearMissLimit > 0 && pident->nearMisses > nearMissLimit) {
/* we have received more than nearMissLimit answers on the right IP and port, from the right source (we are using connected sockets),
for the correct qname and qtype, but with an unexpected message ID. That looks like a spoofing attempt. */
- SLOG(g_log << Logger::Error << "Too many (" << pident->nearMisses << " > " << nearMissLimit << ") answers with a wrong message ID for '" << domain << "' from " << fromAddr.toString() << ", assuming spoof attempt." << endl,
- g_slogudpin->info(Logr::Error, "Too many answers with a wrong message ID, assuming spoofing attempt",
- "nearmisses", Logging::Loggable(pident->nearMisses),
- "nearmisslimit", Logging::Loggable(nearMissLimit),
- "qname", Logging::Loggable(domain),
- "from", Logging::Loggable(fromAddr)));
+ g_slogudpin->info(Logr::Error, "Too many answers with a wrong message ID, assuming spoofing attempt",
+ "nearmisses", Logging::Loggable(pident->nearMisses),
+ "nearmisslimit", Logging::Loggable(nearMissLimit),
+ "qname", Logging::Loggable(domain),
+ "from", Logging::Loggable(fromAddr));
t_Counters.at(rec::Counter::spoofCount)++;
return LWResult::Result::Spoofed;
}
}
if (resolver.doLog() && appliedPolicy.d_type != DNSFilterEngine::PolicyType::None) {
- SLOG(g_log << Logger::Warning << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << appliedPolicy.getLogString() << endl,
- appliedPolicy.info(Logr::Warning, resolver.d_slog));
+ appliedPolicy.info(Logr::Warning, resolver.d_slog);
}
if (appliedPolicy.d_zoneData && appliedPolicy.d_zoneData->d_extendedErrorCode) {
}
catch (const ImmediateServFailException& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during resolve of the custom filter policy '" << appliedPolicy.getName() << "' while resolving '" << comboWriter->d_mdp.d_qname << "' because: " << e.reason << endl,
- resolver.d_slog->error(Logr::Notice, e.reason, "Sending SERVFAIL during resolve of the custom filter policy",
- "policyName", Logging::Loggable(appliedPolicy.getName()), "exception", Logging::Loggable("ImmediateServFailException")));
+ resolver.d_slog->error(Logr::Notice, e.reason, "Sending SERVFAIL during resolve of the custom filter policy",
+ "policyName", Logging::Loggable(appliedPolicy.getName()), "exception", Logging::Loggable("ImmediateServFailException"));
}
res = RCode::ServFail;
break;
}
catch (const pdns::validation::TooManySEC3IterationsException& e) {
if (g_logCommonErrors || (g_dnssecLogBogus && resolver.getDNSSECLimitHit())) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during resolve of the custom filter policy '" << appliedPolicy.getName() << "' while resolving '" << comboWriter->d_mdp.d_qname << "' because: " << e.what() << endl,
- resolver.d_slog->error(Logr::Notice, e.what(), "Sending SERVFAIL during resolve of the custom filter policy",
- "policyName", Logging::Loggable(appliedPolicy.getName()), "exception", Logging::Loggable("TooManySEC3IterationsException"), "dnsseclimithit", Logging::Loggable(resolver.getDNSSECLimitHit())));
+ resolver.d_slog->error(Logr::Notice, e.what(), "Sending SERVFAIL during resolve of the custom filter policy",
+ "policyName", Logging::Loggable(appliedPolicy.getName()), "exception", Logging::Loggable("TooManySEC3IterationsException"), "dnsseclimithit", Logging::Loggable(resolver.getDNSSECLimitHit()));
}
res = RCode::ServFail;
break;
}
catch (const PolicyHitException& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during resolve of the custom filter policy '" << appliedPolicy.getName() << "' while resolving '" << comboWriter->d_mdp.d_qname << "' because another RPZ policy was hit" << endl,
- resolver.d_slog->info(Logr::Notice, "Sending SERVFAIL during resolve of the custom filter policy because another RPZ policy was hit",
- "policyName", Logging::Loggable(appliedPolicy.getName()), "exception", Logging::Loggable("PolicyHitException")));
+ resolver.d_slog->info(Logr::Notice, "Sending SERVFAIL during resolve of the custom filter policy because another RPZ policy was hit",
+ "policyName", Logging::Loggable(appliedPolicy.getName()), "exception", Logging::Loggable("PolicyHitException"));
}
res = RCode::ServFail;
break;
if (g_nodDBp && g_nodDBp->isNewDomain(dname)) {
if (g_nodLog) {
// This should probably log to a dedicated log file
- SLOG(g_log << Logger::Notice << "Newly observed domain nod=" << dname << endl,
- nodlogger->info(Logr::Notice, "New domain observed"));
+ nodlogger->info(Logr::Notice, "New domain observed");
}
t_Counters.at(rec::Counter::nodCount)++;
ret = true;
if (g_udrDBp && g_udrDBp->isUniqueResponse(strStream.str())) {
if (g_udrLog) {
// This should also probably log to a dedicated file.
- SLOG(g_log << Logger::Notice << "Unique response observed: qname=" << dname << " qtype=" << QType(qtype) << " rrtype=" << QType(record.d_type) << " rrname=" << record.d_name << " rrcontent=" << record.getContent()->getZoneRepresentation() << endl,
- nodlogger->info(Logr::Notice, "New response observed",
- "qtype", Logging::Loggable(QType(qtype)),
- "rrtype", Logging::Loggable(QType(record.d_type)),
- "rrname", Logging::Loggable(record.d_name),
- "rrcontent", Logging::Loggable(record.getContent()->getZoneRepresentation())););
+ nodlogger->info(Logr::Notice, "New response observed",
+ "qtype", Logging::Loggable(QType(qtype)),
+ "rrtype", Logging::Loggable(QType(record.d_type)),
+ "rrname", Logging::Loggable(record.d_name),
+ "rrcontent", Logging::Loggable(record.getContent()->getZoneRepresentation()));
}
t_Counters.at(rec::Counter::udrCount)++;
ret = true;
int traceFd = dup(t_tracefd);
if (traceFd == -1) {
int err = errno;
- SLOG(g_log << Logger::Error << "Could not dup trace file: " << stringerror(err) << endl,
- g_slog->withName("trace")->error(Logr::Error, err, "Could not dup trace file"));
+ g_slog->withName("trace")->error(Logr::Error, err, "Could not dup trace file");
return;
}
setNonBlocking(traceFd);
auto filep = pdns::UniqueFilePtr(fdopen(traceFd, "a"));
if (!filep) {
int err = errno;
- SLOG(g_log << Logger::Error << "Could not write to trace file: " << stringerror(err) << endl,
- g_slog->withName("trace")->error(Logr::Error, err, "Could not write to trace file"));
+ g_slog->withName("trace")->error(Logr::Error, err, "Could not write to trace file");
close(traceFd);
return;
}
isoDateTimeMillis(now, timebuf);
if (ferror(filep.get()) != 0) {
int err = errno;
- SLOG(g_log << Logger::Error << "Problems writing to trace file: " << stringerror(err) << endl,
- g_slog->withName("trace")->error(Logr::Error, err, "Problems writing to trace file"));
+ g_slog->withName("trace")->error(Logr::Error, err, "Problems writing to trace file");
// There's no guarantee the message below will end up in the stream, but we try our best
clearerr(filep.get());
fprintf(filep.get(), "=== TRACE %s TRUNCATED; USE FILE ARGUMENT INSTEAD OF `-' ===\n", timebuf.data());
catch (const ImmediateQueryDropException& e) {
// XXX We need to export a protobuf message (and do a NOD lookup) if requested!
t_Counters.at(rec::Counter::policyDrops)++;
- SLOG(g_log << Logger::Debug << "Dropping query because of a filtering policy " << makeLoginfo(comboWriter) << endl,
- resolver.d_slog->info(Logr::Debug, "Dropping query because of a filtering policy"));
+ resolver.d_slog->info(Logr::Debug, "Dropping query because of a filtering policy");
return;
}
catch (const ImmediateServFailException& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during resolve of '" << comboWriter->d_mdp.d_qname << "' because: " << e.reason << endl,
- resolver.d_slog->error(Logr::Notice, e.reason, "Sending SERVFAIL during resolve"));
+ resolver.d_slog->error(Logr::Notice, e.reason, "Sending SERVFAIL during resolve");
}
res = RCode::ServFail;
}
catch (const pdns::validation::TooManySEC3IterationsException& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during resolve of '" << comboWriter->d_mdp.d_qname << "' because: " << e.what() << endl,
- resolver.d_slog->error(Logr::Notice, e.what(), "Sending SERVFAIL during resolve", "dnsseclimithit", Logging::Loggable(true)));
+ resolver.d_slog->error(Logr::Notice, e.what(), "Sending SERVFAIL during resolve", "dnsseclimithit", Logging::Loggable(true));
}
res = RCode::ServFail;
}
}
if (state == vState::Secure) {
if (resolver.doLog()) {
- SLOG(g_log << Logger::Warning << "Answer to " << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << x_marker << " for " << comboWriter->getRemote() << " validates correctly" << endl,
- log->info(Logr::Info, "Validates Correctly"));
+ log->info(Logr::Info, "Validates Correctly");
}
// Is the query source interested in the value of the ad-bit?
}
else if (state == vState::Insecure) {
if (resolver.doLog()) {
- SLOG(g_log << Logger::Warning << "Answer to " << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << x_marker << " for " << comboWriter->getRemote() << " validates as Insecure" << endl,
- log->info(Logr::Info, "Validates as Insecure"));
+ log->info(Logr::Info, "Validates as Insecure");
}
packetWriter.getHeader()->ad = 0;
t_bogusqueryring->push_back({comboWriter->d_mdp.d_qname, comboWriter->d_mdp.d_qtype});
}
if (g_dnssecLogBogus || resolver.doLog() || g_dnssecmode == DNSSECMode::ValidateForLog) {
- SLOG(g_log << Logger::Warning << "Answer to " << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << x_marker << " for " << comboWriter->getRemote() << " validates as " << vStateToString(state) << endl,
- log->info(Logr::Notice, "Validates as Bogus"));
+ log->info(Logr::Notice, "Validates as Bogus");
}
// Does the query or validation mode sending out a SERVFAIL on validation errors?
if (!packetWriter.getHeader()->cd && (g_dnssecmode == DNSSECMode::ValidateAll || comboWriter->d_mdp.d_header.ad || DNSSECOK)) {
if (resolver.doLog()) {
- SLOG(g_log << Logger::Warning << "Sending out SERVFAIL for " << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << " because recursor or query demands it for Bogus results" << endl,
- log->info(Logr::Notice, "Sending out SERVFAIL because recursor or query demands it for Bogus results"));
+ log->info(Logr::Notice, "Sending out SERVFAIL because recursor or query demands it for Bogus results");
}
packetWriter.getHeader()->rcode = RCode::ServFail;
}
else {
if (resolver.doLog()) {
- SLOG(g_log << Logger::Warning << "Not sending out SERVFAIL for " << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << x_marker << " Bogus validation since neither config nor query demands this" << endl,
- log->info(Logr::Notice, "Sending out SERVFAIL because recursor or query demands it for Bogus results"));
+ log->info(Logr::Notice, "Sending out SERVFAIL because recursor or query demands it for Bogus results");
}
}
}
}
catch (const ImmediateServFailException& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during validation of '" << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << "' because: " << e.reason << endl,
- resolver.d_slog->error(Logr::Notice, e.reason, "Sending SERVFAIL during validation", "exception", Logging::Loggable("ImmediateServFailException")));
+ resolver.d_slog->error(Logr::Notice, e.reason, "Sending SERVFAIL during validation", "exception", Logging::Loggable("ImmediateServFailException"));
}
goto sendit; // NOLINT(cppcoreguidelines-avoid-goto)
}
catch (const pdns::validation::TooManySEC3IterationsException& e) {
if (g_logCommonErrors || (g_dnssecLogBogus && resolver.getDNSSECLimitHit())) {
- SLOG(g_log << Logger::Notice << "Sending SERVFAIL to " << comboWriter->getRemote() << " during validation of '" << comboWriter->d_mdp.d_qname << "|" << QType(comboWriter->d_mdp.d_qtype) << "' because: " << e.what() << endl,
- resolver.d_slog->error(Logr::Notice, e.what(), "Sending SERVFAIL during validation", "exception", Logging::Loggable("TooManySEC3IterationsException"), "dnsseclimithit", Logging::Loggable(resolver.getDNSSECLimitHit())));
+ resolver.d_slog->error(Logr::Notice, e.what(), "Sending SERVFAIL during validation", "exception", Logging::Loggable("TooManySEC3IterationsException"), "dnsseclimithit", Logging::Loggable(resolver.getDNSSECLimitHit()));
}
goto sendit; // NOLINT(cppcoreguidelines-avoid-goto)
}
}
int sendErr = sendOnNBSocket(comboWriter->d_socket, &msgh);
if (sendErr != 0 && g_logCommonErrors) {
- SLOG(g_log << Logger::Warning << "Sending UDP reply to client " << comboWriter->getRemote() << " failed with: "
- << stringerror(sendErr) << endl,
- g_slogudpin->error(Logr::Warning, sendErr, "Sending UDP reply to client failed"));
+ g_slogudpin->error(Logr::Warning, sendErr, "Sending UDP reply to client failed");
}
}
else {
}
if (resolver.d_eventTrace.enabled() && SyncRes::eventTraceEnabled(SyncRes::event_trace_to_log)) {
- SLOG(g_log << Logger::Info << resolver.d_eventTrace.toString() << endl,
- resolver.d_slog->info(Logr::Info, resolver.d_eventTrace.toString())); // Maybe we want it to be more fancy?
+ resolver.d_slog->info(Logr::Info, resolver.d_eventTrace.toString()); // Maybe we want it to be more fancy?
}
// Originally this code used a mix of floats, doubles, uint64_t with different units.
// cout<<dc->d_mdp.d_qname<<"\t"<<MT->getUsec()<<"\t"<<sr.d_outqueries<<endl;
}
catch (const PDNSException& ae) {
- SLOG(g_log << Logger::Error << "startDoResolve problem " << makeLoginfo(comboWriter) << ": " << ae.reason << endl,
- resolver.d_slog->error(Logr::Error, ae.reason, "startDoResolve problem", "exception", Logging::Loggable("PDNSException")));
+ resolver.d_slog->error(Logr::Error, ae.reason, "startDoResolve problem", "exception", Logging::Loggable("PDNSException"));
}
catch (const MOADNSException& mde) {
- SLOG(g_log << Logger::Error << "DNS parser error " << makeLoginfo(comboWriter) << ": " << comboWriter->d_mdp.d_qname << ", " << mde.what() << endl,
- resolver.d_slog->error(Logr::Error, mde.what(), "DNS parser error"));
+ resolver.d_slog->error(Logr::Error, mde.what(), "DNS parser error");
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "STL error " << makeLoginfo(comboWriter) << ": " << e.what(),
- resolver.d_slog->error(Logr::Error, e.what(), "Exception in resolver context", "exception", Logging::Loggable("std::exception")));
+ resolver.d_slog->error(Logr::Error, e.what(), "Exception in resolver context", "exception", Logging::Loggable("std::exception"));
// Luawrapper nests the exception from Lua, so we unnest it here
try {
std::rethrow_if_nested(e);
}
catch (const std::exception& ne) {
- SLOG(g_log << ". Extra info: " << ne.what(),
- 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", Logging::Loggable("std::exception"));
}
catch (...) {
}
}
}
catch (...) {
- SLOG(g_log << Logger::Error << "Any other exception in a resolver context " << makeLoginfo(comboWriter) << endl,
- resolver.d_slog->info(Logr::Error, "Any other exception in a resolver context"));
+ resolver.d_slog->info(Logr::Error, "Any other exception in a resolver context");
}
runTaskOnce(g_logCommonErrors);
static const size_t stackSizeThreshold = 9 * ::arg().asNum("stack-size") / 10;
if (g_multiTasker->getMaxStackUsage() >= stackSizeThreshold) {
- SLOG(g_log << Logger::Error << "Reached mthread stack usage of 90%: " << g_multiTasker->getMaxStackUsage() << " " << makeLoginfo(comboWriter) << " after " << resolver.d_outqueries << " out queries, " << resolver.d_tcpoutqueries << " TCP out queries, " << resolver.d_dotoutqueries << " DoT out queries" << endl,
- resolver.d_slog->info(Logr::Error, "Reached mthread stack usage of 90%",
- "stackUsage", Logging::Loggable(g_multiTasker->getMaxStackUsage()),
- "outqueries", Logging::Loggable(resolver.d_outqueries),
- "netms", Logging::Loggable(resolver.d_totUsec / 1000.0),
- "throttled", Logging::Loggable(resolver.d_throttledqueries),
- "timeouts", Logging::Loggable(resolver.d_timeouts),
- "tcpout", Logging::Loggable(resolver.d_tcpoutqueries),
- "dotout", Logging::Loggable(resolver.d_dotoutqueries),
- "validationState", Logging::Loggable(resolver.getValidationState())));
+ resolver.d_slog->info(Logr::Error, "Reached mthread stack usage of 90%",
+ "stackUsage", Logging::Loggable(g_multiTasker->getMaxStackUsage()),
+ "outqueries", Logging::Loggable(resolver.d_outqueries),
+ "netms", Logging::Loggable(resolver.d_totUsec / 1000.0),
+ "throttled", Logging::Loggable(resolver.d_throttledqueries),
+ "timeouts", Logging::Loggable(resolver.d_timeouts),
+ "tcpout", Logging::Loggable(resolver.d_tcpoutqueries),
+ "dotout", Logging::Loggable(resolver.d_dotoutqueries),
+ "validationState", Logging::Loggable(resolver.getValidationState()));
}
t_Counters.at(rec::Counter::maxMThreadStackUsage) = max(g_multiTasker->getMaxStackUsage(), t_Counters.at(rec::Counter::maxMThreadStackUsage));
t_Counters.updateSnap(g_regressionTestMode);
static void* pleaseWipeCaches(const DNSName& canon, bool subtree, uint16_t qtype)
{
auto res = wipeCaches(canon, subtree, qtype);
- SLOG(g_log << Logger::Info << "Wiped caches for " << canon << ": " << res.record_count << " records; " << res.negative_record_count << " negative records; " << res.packet_count << " packets" << endl,
- g_slog->withName("runtime")->info(Logr::Info, "Wiped cache", "qname", Logging::Loggable(canon), "records", Logging::Loggable(res.record_count), "negrecords", Logging::Loggable(res.negative_record_count), "packets", Logging::Loggable(res.packet_count)));
+ g_slog->withName("runtime")->info(Logr::Info, "Wiped cache", "qname", Logging::Loggable(canon), "records", Logging::Loggable(res.record_count), "negrecords", Logging::Loggable(res.negative_record_count), "packets", Logging::Loggable(res.packet_count));
return nullptr;
}
eventTrace.add(RecEventTrace::PCacheCheck, cacheHit, false, match);
if (cacheHit) {
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " question answered from packet cache tag=" << ctag << " from " << source.toStringWithPort() << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << endl,
- g_slogudpin->info(Logr::Notice, "Question answered from packet cache", "tag", Logging::Loggable(ctag),
- "qname", Logging::Loggable(qname), "qtype", Logging::Loggable(QType(qtype)),
- "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Notice, "Question answered from packet cache", "tag", Logging::Loggable(ctag),
+ "qname", Logging::Loggable(qname), "qtype", Logging::Loggable(QType(qtype)),
+ "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr));
}
struct msghdr msgh{};
struct iovec iov{};
}
if (eventTrace.enabled() && SyncRes::eventTraceEnabled(SyncRes::event_trace_to_log)) {
- SLOG(g_log << Logger::Info << eventTrace.toString() << endl,
- g_slogudpin->info(Logr::Info, eventTrace.toString())); // Do we want more fancy logging here?
+ g_slogudpin->info(Logr::Info, eventTrace.toString()); // Do we want more fancy logging here?
}
if (sendErr != 0 && g_logCommonErrors) {
- SLOG(g_log << Logger::Warning << "Sending UDP reply to client " << source.toStringWithPort()
- << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << " failed with: "
- << stringerror(sendErr) << endl,
- g_slogudpin->error(Logr::Error, sendErr, "Sending UDP reply to client failed", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->error(Logr::Error, sendErr, "Sending UDP reply to client failed", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr));
}
struct timeval now{};
Utility::gettimeofday(&now, nullptr);
}
catch (const std::exception& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Error processing or aging answer packet: " << e.what() << endl,
- g_slogudpin->error(Logr::Error, e.what(), "Error processing or aging answer packet", "exception", Logging::Loggable("std::exception")));
+ g_slogudpin->error(Logr::Error, e.what(), "Error processing or aging answer packet", "exception", Logging::Loggable("std::exception"));
}
return nullptr;
}
bool ipf = t_pdl->ipfilter(source, destination, *dnsheader, eventTrace);
if (ipf) {
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " [" << g_multiTasker->getTid() << "/" << g_multiTasker->numProcesses() << "] DROPPED question from " << source.toStringWithPort() << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << " based on policy" << endl,
- g_slogudpin->info(Logr::Notice, "Dropped question based on policy", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Notice, "Dropped question based on policy", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr));
}
t_Counters.at(rec::Counter::policyDrops)++;
return nullptr;
if (dnsheader->opcode == static_cast<unsigned>(Opcode::Notify)) {
if (!isAllowNotifyForZone(qname)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping UDP NOTIFY from " << source.toStringWithPort() << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << ", for " << qname.toLogString() << ", zone not matched by allow-notify-for" << endl,
- g_slogudpin->info(Logr::Notice, "Dropping UDP NOTIFY, zone not matched by allow-notify-for", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Notice, "Dropping UDP NOTIFY, zone not matched by allow-notify-for", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr));
}
t_Counters.at(rec::Counter::zoneDisallowedNotify)++;
}
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " got NOTIFY for " << qname.toLogString() << " from " << source.toStringWithPort() << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << endl,
- g_slogudpin->info(Logr::Notice, "Got NOTIFY", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr), "qname", Logging::Loggable(qname)));
+ g_slogudpin->info(Logr::Notice, "Got NOTIFY", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr), "qname", Logging::Loggable(qname));
}
if (!ZoneXFR::notifyZoneTracker(qname)) {
// It wasn't an RPZ
if (g_multiTasker->numProcesses() >= g_maxMThreads) {
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " [" << g_multiTasker->getTid() << "/" << g_multiTasker->numProcesses() << "] DROPPED question from " << source.toStringWithPort() << (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << ", over capacity" << endl,
- g_slogudpin->info(Logr::Notice, "Dropped question, over capacity", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Notice, "Dropped question, over capacity", "source", Logging::Loggable(source), "remote", Logging::Loggable(fromaddr));
}
t_Counters.at(rec::Counter::overCapacityDrops)++;
return nullptr;
if ((msgh.msg_flags & MSG_TRUNC) != 0) {
t_Counters.at(rec::Counter::truncatedDrops)++;
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "Ignoring truncated query from " << fromaddr.toString() << endl,
- g_slogudpin->info(Logr::Error, "Ignoring truncated query", "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Ignoring truncated query", "remote", Logging::Loggable(fromaddr));
}
return;
}
if (used <= 0) {
++t_Counters.at(rec::Counter::proxyProtocolInvalidCount);
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "Ignoring invalid proxy protocol (" << std::to_string(len) << ", " << std::to_string(used) << ") query from " << fromaddr.toStringWithPort() << endl,
- g_slogudpin->info(Logr::Error, "Ignoring invalid proxy protocol query", "length", Logging::Loggable(len),
- "used", Logging::Loggable(used), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Ignoring invalid proxy protocol query", "length", Logging::Loggable(len),
+ "used", Logging::Loggable(used), "remote", Logging::Loggable(fromaddr));
}
return;
}
if (static_cast<size_t>(used) > g_proxyProtocolMaximumSize) {
if (g_quiet) {
- SLOG(g_log << Logger::Error << "Proxy protocol header in UDP packet from " << fromaddr.toStringWithPort() << " is larger than proxy-protocol-maximum-size (" << used << "), dropping" << endl,
- g_slogudpin->info(Logr::Error, "Proxy protocol header in UDP packet is larger than proxy-protocol-maximum-size",
- "used", Logging::Loggable(used), "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Proxy protocol header in UDP packet is larger than proxy-protocol-maximum-size",
+ "used", Logging::Loggable(used), "remote", Logging::Loggable(fromaddr));
}
++t_Counters.at(rec::Counter::proxyProtocolInvalidCount);
return;
/* we only allow UDP packets larger than 512 for those with a proxy protocol header */
t_Counters.at(rec::Counter::truncatedDrops)++;
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "Ignoring truncated query from " << fromaddr.toStringWithPort() << endl,
- g_slogudpin->info(Logr::Error, "Ignoring truncated query", "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Ignoring truncated query", "remote", Logging::Loggable(fromaddr));
}
return;
}
if (data.size() < sizeof(dnsheader)) {
t_Counters.at(rec::Counter::ignoredCount)++;
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "Ignoring too-short (" << std::to_string(data.size()) << ") query from " << fromaddr.toString() << endl,
- g_slogudpin->info(Logr::Error, "Ignoring too-short query", "length", Logging::Loggable(data.size()),
- "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Ignoring too-short query", "length", Logging::Loggable(data.size()),
+ "remote", Logging::Loggable(fromaddr));
}
return;
}
if (t_allowFrom && !t_allowFrom->match(&mappedSource)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping UDP query from " << mappedSource.toString() << ", address not matched by allow-from" << endl,
- g_slogudpin->info(Logr::Error, "Dropping UDP query, address not matched by allow-from", "source", Logging::Loggable(mappedSource)));
+ g_slogudpin->info(Logr::Error, "Dropping UDP query, address not matched by allow-from", "source", Logging::Loggable(mappedSource));
}
t_Counters.at(rec::Counter::unauthorizedUDP)++;
BOOST_STATIC_ASSERT(offsetof(sockaddr_in, sin_port) == offsetof(sockaddr_in6, sin6_port));
if (fromaddr.sin4.sin_port == 0) { // also works for IPv6
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping UDP query from " << fromaddr.toStringWithPort() << ", can't deal with port 0" << endl,
- g_slogudpin->info(Logr::Error, "Dropping UDP query can't deal with port 0", "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Dropping UDP query can't deal with port 0", "remote", Logging::Loggable(fromaddr));
}
t_Counters.at(rec::Counter::clientParseError)++; // not quite the best place to put it, but needs to go somewhere
if (dnsheader->qr) {
t_Counters.at(rec::Counter::ignoredCount)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Ignoring answer from " << fromaddr.toString() << " on server socket!" << endl,
- g_slogudpin->info(Logr::Error, "Ignoring answer on server socket", "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Ignoring answer on server socket", "remote", Logging::Loggable(fromaddr));
}
}
else if (dnsheader->opcode != static_cast<unsigned>(Opcode::Query) && dnsheader->opcode != static_cast<unsigned>(Opcode::Notify)) {
t_Counters.at(rec::Counter::ignoredCount)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Ignoring unsupported opcode " << Opcode::to_s(dnsheader->opcode) << " from " << fromaddr.toString() << " on server socket!" << endl,
- g_slogudpin->info(Logr::Error, "Ignoring unsupported opcode server socket", "remote", Logging::Loggable(fromaddr), "opcode", Logging::Loggable(Opcode::to_s(dnsheader->opcode))));
+ g_slogudpin->info(Logr::Error, "Ignoring unsupported opcode server socket", "remote", Logging::Loggable(fromaddr), "opcode", Logging::Loggable(Opcode::to_s(dnsheader->opcode)));
}
}
else if (dnsheader->qdcount == 0U) {
t_Counters.at(rec::Counter::emptyQueriesCount)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Ignoring empty (qdcount == 0) query from " << fromaddr.toString() << " on server socket!" << endl,
- g_slogudpin->info(Logr::Error, "Ignoring empty (qdcount == 0) query on server socket!", "remote", Logging::Loggable(fromaddr)));
+ g_slogudpin->info(Logr::Error, "Ignoring empty (qdcount == 0) query on server socket!", "remote", Logging::Loggable(fromaddr));
}
}
else {
if (dnsheader->opcode == static_cast<unsigned>(Opcode::Notify)) {
if (!t_allowNotifyFrom || !t_allowNotifyFrom->match(&mappedSource)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping UDP NOTIFY from " << mappedSource.toString() << ", address not matched by allow-notify-from" << endl,
- g_slogudpin->info(Logr::Error, "Dropping UDP NOTIFY from address not matched by allow-notify-from",
- "source", Logging::Loggable(mappedSource)));
+ g_slogudpin->info(Logr::Error, "Dropping UDP NOTIFY from address not matched by allow-notify-from",
+ "source", Logging::Loggable(mappedSource));
}
t_Counters.at(rec::Counter::sourceDisallowedNotify)++;
catch (const MOADNSException& mde) {
t_Counters.at(rec::Counter::clientParseError)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unable to parse packet from remote UDP client " << fromaddr.toString() << ": " << mde.what() << endl,
- g_slogudpin->error(Logr::Error, mde.what(), "Unable to parse packet from remote UDP client", "remote", Logging::Loggable(fromaddr), "exception", Logging::Loggable("MOADNSException")));
+ g_slogudpin->error(Logr::Error, mde.what(), "Unable to parse packet from remote UDP client", "remote", Logging::Loggable(fromaddr), "exception", Logging::Loggable("MOADNSException"));
}
}
catch (const std::runtime_error& e) {
t_Counters.at(rec::Counter::clientParseError)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unable to parse packet from remote UDP client " << fromaddr.toString() << ": " << e.what() << endl,
- g_slogudpin->error(Logr::Error, e.what(), "Unable to parse packet from remote UDP client", "remote", Logging::Loggable(fromaddr), "exception", Logging::Loggable("std::runtime_error")));
+ g_slogudpin->error(Logr::Error, e.what(), "Unable to parse packet from remote UDP client", "remote", Logging::Loggable(fromaddr), "exception", Logging::Loggable("std::runtime_error"));
}
}
}
}
if (!setSocketTimestamps(socketFd)) {
- SLOG(g_log << Logger::Warning << "Unable to enable timestamp reporting for socket" << endl,
- log->info(Logr::Warning, "Unable to enable timestamp reporting for socket"));
+ log->info(Logr::Warning, "Unable to enable timestamp reporting for socket");
}
if (IsAnyAddress(address)) {
if (address.sin4.sin_family == AF_INET) {
#endif
if (address.sin6.sin6_family == AF_INET6 && setsockopt(socketFd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)) < 0) {
int err = errno;
- SLOG(g_log << Logger::Warning << "Failed to set IPv6 socket to IPv6 only, continuing anyhow: " << stringerror(err) << endl,
- log->error(Logr::Warning, err, "Failed to set IPv6 socket to IPv6 only, continuing anyhow"));
+ log->error(Logr::Warning, err, "Failed to set IPv6 socket to IPv6 only, continuing anyhow");
}
}
if (::arg().mustDo("non-local-bind")) {
setSocketReceiveBuffer(socketFd, 250000);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while setting socket buffer size"));
+ log->error(Logr::Error, e.what(), "Exception while setting socket buffer size");
}
if (g_reusePort) {
setSocketIgnorePMTU(socketFd, address.sin4.sin_family);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Failed to set IP_MTU_DISCOVER on UDP server socket: " << e.what() << endl,
- log->error(Logr::Warning, e.what(), "Failed to set IP_MTU_DISCOVER on UDP server socket"));
+ log->error(Logr::Warning, e.what(), "Failed to set IP_MTU_DISCOVER on UDP server socket");
}
socklen_t socklen = address.getSocklen();
{
auto& targetInfo = RecThreadInfo::info(target);
if (!targetInfo.isWorker()) {
- SLOG(g_log << Logger::Error << "distributeAsyncFunction() tried to assign a query to a non-worker thread" << endl,
- g_slog->withName("runtime")->info(Logr::Error, "distributeAsyncFunction() tried to assign a query to a non-worker thread"));
+ g_slog->withName("runtime")->info(Logr::Error, "distributeAsyncFunction() tried to assign a query to a non-worker thread");
_exit(1);
}
void distributeAsyncFunction(const string& packet, const pipefunc_t& func)
{
if (!RecThreadInfo::self().isDistributor()) {
- SLOG(g_log << Logger::Error << "distributeAsyncFunction() has been called by a worker (" << RecThreadInfo::id() << ")" << endl,
- g_slog->withName("runtime")->info(Logr::Error, "distributeAsyncFunction() has been called by a worker")); // tid will be added
+ g_slog->withName("runtime")->info(Logr::Error, "distributeAsyncFunction() has been called by a worker"); // tid will be added
_exit(1);
}
// Drop it, but continue to wait for other packets
t_Counters.at(rec::Counter::serverParseError)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unable to parse too short packet from remote UDP server " << fromaddr.toString() << ": packet smaller than DNS header" << endl,
- g_slogout->info(Logr::Error, "Unable to parse too short packet from remote UDP server", "from", Logging::Loggable(fromaddr)));
+ g_slogout->info(Logr::Error, "Unable to parse too short packet from remote UDP server", "from", Logging::Loggable(fromaddr));
}
return;
}
pident->fd = fileDesc;
if (!dnsheader.qr && g_logCommonErrors) {
- SLOG(g_log << Logger::Notice << "Not taking data from question on outgoing socket from " << fromaddr.toStringWithPort() << endl,
- g_slogout->info(Logr::Error, "Not taking data from question on outgoing socket", "from", Logging::Loggable(fromaddr)));
+ g_slogout->info(Logr::Error, "Not taking data from question on outgoing socket", "from", Logging::Loggable(fromaddr));
}
if (dnsheader.qdcount == 0U || // UPC, Nominum, very old BIND on FormErr, NSD
catch (std::exception& e) {
// Parse error, continue waiting for other packets
t_Counters.at(rec::Counter::serverParseError)++; // won't be fed to lwres.cc, so we have to increment
- SLOG(g_log << Logger::Warning << "Error in packet from remote nameserver " << fromaddr.toStringWithPort() << ": " << e.what() << endl,
- g_slogudpin->error(Logr::Warning, e.what(), "Error in packet from remote nameserver", "from", Logging::Loggable(fromaddr)));
+ g_slogudpin->error(Logr::Warning, e.what(), "Error in packet from remote nameserver", "from", Logging::Loggable(fromaddr));
return;
}
}
}
t_Counters.at(rec::Counter::unexpectedCount)++; // if we made it here, it really is an unexpected answer
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Warning << "Discarding unexpected packet from " << fromaddr.toStringWithPort() << ": " << (pident->domain.empty() ? "<empty>" : pident->domain.toString()) << ", " << pident->type << ", " << g_multiTasker->getWaiters().size() << " waiters" << endl,
- g_slogudpin->info(Logr::Warning, "Discarding unexpected packet", "from", Logging::Loggable(fromaddr),
- "qname", Logging::Loggable(pident->domain),
- "qtype", Logging::Loggable(QType(pident->type)),
- "waiters", Logging::Loggable(g_multiTasker->getWaiters().size())));
+ g_slogudpin->info(Logr::Warning, "Discarding unexpected packet", "from", Logging::Loggable(fromaddr),
+ "qname", Logging::Loggable(pident->domain),
+ "qtype", Logging::Loggable(QType(pident->type)),
+ "waiters", Logging::Loggable(g_multiTasker->getWaiters().size()));
}
}
else if (fileDesc >= 0) {
}
}
- SLOG(g_log << Logger::Info << "Loaded the Public Suffix List from '" << file << "'" << endl,
- g_slog->withName("runtime")->info(Logr::Info, "Loaded the Public Suffix List", "file", Logging::Loggable(file)));
+ g_slog->withName("runtime")->info(Logr::Info, "Loaded the Public Suffix List", "file", Logging::Loggable(file));
loaded = true;
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Error while loading the Public Suffix List from '" << file << "', falling back to the built-in list: " << e.what() << endl,
- g_slog->withName("runtime")->error(Logr::Error, e.what(), "Error while loading the Public Suffix List", "file", Logging::Loggable(file)));
+ g_slog->withName("runtime")->error(Logr::Error, e.what(), "Error while loading the Public Suffix List", "file", Logging::Loggable(file));
}
}
{
uint32_t count{};
if (doLog(count)) {
- SLOG(g_log << Logger::Error << msg << " created an exception" << endl,
- slog->info(Logr::Error, msg + " created an exception",
- "ratelimitingSkipped", Logging::Loggable(count),
- "exception", Logging::Loggable("other"), args...));
+ slog->info(Logr::Error, msg + " created an exception",
+ "ratelimitingSkipped", Logging::Loggable(count),
+ "exception", Logging::Loggable("other"), args...);
};
}
{
uint32_t count{};
if (doLog(count)) {
- SLOG(g_log << Logger::Error << msg << " created an exception: " << stdException.what() << endl,
- slog->error(Logr::Error, stdException.what(), msg + " created an exception",
- "ratelimitingSkipped", Logging::Loggable(count),
- "exception", Logging::Loggable("std::exception"), args...));
+ slog->error(Logr::Error, stdException.what(), msg + " created an exception",
+ "ratelimitingSkipped", Logging::Loggable(count),
+ "exception", Logging::Loggable("std::exception"), args...);
}
}
{
uint32_t count{};
if (doLog(count)) {
- SLOG(g_log << Logger::Error << msg << " created an PDNSException: " << pdnsException.reason << endl,
- slog->error(Logr::Error, pdnsException.reason, msg + " created an exception",
- "ratelimitingSkipped", Logging::Loggable(count),
- "exception", Logging::Loggable("PDNSException"), args...));
+ slog->error(Logr::Error, pdnsException.reason, msg + " created an exception",
+ "ratelimitingSkipped", Logging::Loggable(count),
+ "exception", Logging::Loggable("PDNSException"), args...);
}
}
auto ret = asendtcp(msg, handler); // this will actually do the right thing waiting on the connect
if (ret == LWResult::Result::Timeout) {
- SLOG(g_log << Logger::Warning << "Timeout connecting/writing carbon data to " << remote.toStringWithPort() << endl,
- log->info(Logr::Warning, "Timeout connecting/writing carbon data", "address", Logging::Loggable(remote)));
+ log->info(Logr::Warning, "Timeout connecting/writing carbon data", "address", Logging::Loggable(remote));
}
else if (ret != LWResult::Result::Success) {
int err = errno;
- SLOG(g_log << Logger::Warning << "Error writing carbon data to " << remote.toStringWithPort() << ": " << stringerror(err) << endl,
- log->error(Logr::Warning, err, "Error writing carbon data", "address", Logging::Loggable(remote)));
+ log->error(Logr::Warning, err, "Error writing carbon data", "address", Logging::Loggable(remote));
}
handler->close();
}
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error in carbon thread: " << e.reason << endl,
- log->error(Logr::Error, e.reason, "Error in carbon thread", "exception", Logging::Loggable("PDNSException")));
+ log->error(Logr::Error, e.reason, "Error in carbon thread", "exception", Logging::Loggable("PDNSException"));
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Error in carbon thread: " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Error in carbon thread", "exception", Logging::Loggable("std::exception")));
+ log->error(Logr::Error, e.what(), "Error in carbon thread", "exception", Logging::Loggable("std::exception"));
}
catch (...) {
- SLOG(g_log << Logger::Error << "Unknown error in carbon thread" << endl,
- log->info(Logr::Error, "Error in carbon thread"));
+ log->info(Logr::Error, "Error in carbon thread");
}
}
if (have.count("refresh") != 0) {
params.zoneXFRParams.refreshFromConf = boost::get<uint32_t>(have.at("refresh"));
if (params.zoneXFRParams.refreshFromConf == 0) {
- SLOG(g_log << Logger::Warning << "rpzPrimary refresh value of 0 ignored" << endl,
- lci.d_slog->info(Logr::Warning, "rpzPrimary refresh value of 0 ignored"));
+ lci.d_slog->info(Logr::Warning, "rpzPrimary refresh value of 0 ignored");
}
}
lci.rpzs.emplace_back(params);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Problem configuring 'rpzPrimary': " << e.what() << endl,
- lci.d_slog->error(Logr::Error, e.what(), "Exception configuring 'rpzPrimary'", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, e.what(), "Exception configuring 'rpzPrimary'", "exception", Logging::Loggable("std::exception"));
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Problem configuring 'rpzPrimary': " << e.reason << endl,
- 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'", Logging::Loggable("PDNSException"));
}
}
});
Lua->writeFunction("rpzMaster", [&lci](const boost::variant<string, std::vector<std::pair<int, string>>>& primaries_, const string& zoneName, const boost::optional<rpzOptions_t>& options) {
- SLOG(g_log << Logger::Warning << "'rpzMaster' is deprecated and will be removed in a future release, use 'rpzPrimary' instead" << endl,
- lci.d_slog->info(Logr::Warning, "'rpzMaster' is deprecated and will be removed in a future release, use 'rpzPrimary' instead"));
+ lci.d_slog->info(Logr::Warning, "'rpzMaster' is deprecated and will be removed in a future release, use 'rpzPrimary' instead");
rpzPrimary(lci, primaries_, zoneName, options);
});
Lua->writeFunction("rpzPrimary", [&lci](const boost::variant<string, std::vector<std::pair<int, string>>>& primaries_, const string& zoneName, const boost::optional<rpzOptions_t>& options) {
lci.ztcConfigs[validZoneName] = std::move(conf);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Problem configuring zoneToCache for zone '" << zoneName << "': " << e.what() << endl,
- lci.d_slog->error(Logr::Error, e.what(), "Problem configuring zoneToCache", "zone", Logging::Loggable(zoneName),
- "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, e.what(), "Problem configuring zoneToCache", "zone", Logging::Loggable(zoneName),
+ "exception", Logging::Loggable("std::exception"));
}
});
}
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Error in addSortList: " << e.what() << endl,
- lci.d_slog->error(Logr::Error, e.what(), "Error in addSortList", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, e.what(), "Error in addSortList", "exception", Logging::Loggable("std::exception"));
}
});
/* Remove in 4.3 */
Lua->writeFunction("addDS", [&lci](const std::string& who, const std::string& what) {
- SLOG(g_log << Logger::Warning << "addDS is deprecated and will be removed in the future, switch to addTA" << endl,
- lci.d_slog->info(Logr::Warning, "addDS is deprecated and will be removed in the future, switch to addTA"));
+ lci.d_slog->info(Logr::Warning, "addDS is deprecated and will be removed in the future, switch to addTA");
DNSName zone(who);
auto ds = std::dynamic_pointer_cast<DSRecordContent>(DSRecordContent::make(what));
lci.dsAnchors[zone].insert(*ds);
/* Remove in 4.3 */
Lua->writeFunction("clearDS", [&lci](boost::optional<string> who) {
- SLOG(g_log << Logger::Warning << "clearDS is deprecated and will be removed in the future, switch to clearTA" << endl,
- lci.d_slog->info(Logr::Warning, "clearDS is deprecated and will be removed in the future, switch to clearTA"));
+ lci.d_slog->info(Logr::Warning, "clearDS is deprecated and will be removed in the future, switch to clearTA");
if (who)
lci.dsAnchors.erase(DNSName(*who));
else
parseProtobufOptions(vars, lci.protobufExportConfig);
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Error while adding protobuf logger: " << e.what() << endl,
- lci.d_slog->error(Logr::Error, e.what(), "Exception while adding protobuf logger", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, e.what(), "Exception while adding protobuf logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error while adding protobuf logger: " << e.reason << endl,
- lci.d_slog->error(Logr::Error, e.reason, "Exception while adding protobuf logger", "exception", Logging::Loggable("PDNSException")));
+ lci.d_slog->error(Logr::Error, e.reason, "Exception while adding protobuf logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
- SLOG(g_log << Logger::Error << "Only one protobufServer() directive can be configured, we already have " << lci.protobufExportConfig.servers.at(0).toString() << endl,
- lci.d_slog->info(Logr::Error, "Only one protobufServer() directive can be configured", "existing", Logging::Loggable(lci.protobufExportConfig.servers.at(0).toString())));
+ lci.d_slog->info(Logr::Error, "Only one protobufServer() directive can be configured", "existing", Logging::Loggable(lci.protobufExportConfig.servers.at(0).toString()));
}
});
parseProtobufOptions(vars, lci.outgoingProtobufExportConfig);
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Error while starting outgoing protobuf logger: " << e.what() << endl,
- lci.d_slog->error(Logr::Error, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error while starting outgoing protobuf logger: " << e.reason << endl,
- lci.d_slog->error(Logr::Error, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("PDNSException")));
+ lci.d_slog->error(Logr::Error, "Exception while starting outgoing protobuf logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
- SLOG(g_log << Logger::Error << "Only one outgoingProtobufServer() directive can be configured, we already have " << lci.outgoingProtobufExportConfig.servers.at(0).toString() << endl,
- lci.d_slog->info(Logr::Error, "Only one outgoingProtobufServer() directive can be configured", "existing", Logging::Loggable(lci.outgoingProtobufExportConfig.servers.at(0).toString())));
+ lci.d_slog->info(Logr::Error, "Only one outgoingProtobufServer() directive can be configured", "existing", Logging::Loggable(lci.outgoingProtobufExportConfig.servers.at(0).toString()));
}
});
parseFrameStreamOptions(vars, lci.frameStreamExportConfig);
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Error reading config for dnstap framestream logger: " << e.what() << endl,
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error reading config for dnstap framestream logger: " << e.reason << endl,
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("PDNSException")));
+ lci.d_slog->error(Logr::Error, "Exception reading config for dnstap framestream logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
- SLOG(g_log << Logger::Error << "Only one dnstapFrameStreamServer() directive can be configured, we already have " << lci.frameStreamExportConfig.servers.at(0) << endl,
- 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)));
}
});
Lua->writeFunction("dnstapNODFrameStreamServer", [&lci](boost::variant<const std::string, const std::unordered_map<int, std::string>> servers, boost::optional<frameStreamOptions_t> vars) {
parseFrameStreamOptions(vars, lci.nodFrameStreamExportConfig);
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Error reading config for dnstap NOD framestream logger: " << e.what() << endl,
- 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, "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error reading config for dnstap NOD framestream logger: " << e.reason << endl,
- lci.d_slog->error(Logr::Error, "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("PDNSException")));
+ lci.d_slog->error(Logr::Error, "Exception reading config for dnstap NOD framestream logger", "exception", Logging::Loggable("PDNSException"));
}
}
else {
- SLOG(g_log << Logger::Error << "Only one dnstapNODFrameStreamServer() directive can be configured, we already have " << lci.nodFrameStreamExportConfig.servers.at(0) << endl,
- 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 */
case QType::NAPTR:
break;
default:
- SLOG(g_log << Logger::Error << "addAllowedAdditionalQType does not support " << QType(qtype).toString() << endl,
- lci.d_slog->info(Logr::Error, "addAllowedAdditionalQType does not support this qtype", "qtype", Logging::Loggable(QType(qtype).toString())));
+ lci.d_slog->info(Logr::Error, "addAllowedAdditionalQType does not support this qtype", "qtype", Logging::Loggable(QType(qtype).toString()));
return;
}
if (const auto it = options->find("mode"); it != options->end()) {
mode = static_cast<AdditionalMode>(it->second);
if (mode > AdditionalMode::ResolveDeferred) {
- SLOG(g_log << Logger::Error << "addAllowedAdditionalQType: unknown mode " << it->second << endl,
- lci.d_slog->info(Logr::Error, "addAllowedAdditionalQType: unknown mode", "mode", Logging::Loggable( it->second)));
+ lci.d_slog->info(Logr::Error, "addAllowedAdditionalQType: unknown mode", "mode", Logging::Loggable( it->second));
}
}
}
proxyMapping.insert_or_assign(netmask, {address, smn});
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Error processing addProxyMapping: " << e.what() << endl,
- lci.d_slog->error(Logr::Error, e.what(), "Exception processing addProxyMapping", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, e.what(), "Exception processing addProxyMapping", "exception", Logging::Loggable("std::exception"));
}
catch (PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error processing addProxyMapping: " << e.reason << endl,
- lci.d_slog->error(Logr::Error, e.reason, "Exception processing addProxyMapping", "exception", Logging::Loggable("PDNSException")));
+ lci.d_slog->error(Logr::Error, e.reason, "Exception processing addProxyMapping", "exception", Logging::Loggable("PDNSException"));
}
});
newLuaConfig = std::move(lci);
}
catch (const LuaContext::ExecutionErrorException& e) {
- SLOG(g_log << Logger::Error << "Unable to load Lua script from '" + fname + "': ",
- lci.d_slog->error(Logr::Error, e.what(), "Unable to load Lua script", "file", Logging::Loggable(fname)));
+ lci.d_slog->error(Logr::Error, e.what(), "Unable to load Lua script", "file", Logging::Loggable(fname));
try {
std::rethrow_if_nested(e);
}
catch (const std::exception& exp) {
// exp is the exception that was thrown from inside the lambda
- SLOG(g_log << exp.what() << std::endl,
- lci.d_slog->error(Logr::Error, exp.what(), "Exception loading Lua", "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, exp.what(), "Exception loading Lua", "exception", Logging::Loggable("std::exception"));
}
catch (const PDNSException& exp) {
// exp is the exception that was thrown from inside the lambda
- SLOG(g_log << exp.reason << std::endl,
- lci.d_slog->error(Logr::Error, exp.reason, "Exception loading Lua", "exception", Logging::Loggable("PDNSException")));
+ lci.d_slog->error(Logr::Error, exp.reason, "Exception loading Lua", "exception", Logging::Loggable("PDNSException"));
}
throw;
}
catch (std::exception& err) {
- SLOG(g_log << Logger::Error << "Unable to load Lua script from '" + fname + "': " << err.what() << endl,
- lci.d_slog->error(Logr::Error, err.what(), "Unable to load Lua script", "file", Logging::Loggable(fname), "exception", Logging::Loggable("std::exception")));
+ lci.d_slog->error(Logr::Error, err.what(), "Unable to load Lua script", "file", Logging::Loggable(fname), "exception", Logging::Loggable("std::exception"));
throw;
}
}
const std::string value = ::arg()["cpu-map"];
if (!value.empty() && !isSettingThreadCPUAffinitySupported()) {
- SLOG(g_log << Logger::Warning << "CPU mapping requested but not supported, skipping" << endl,
- log->info(Logr::Warning, "CPU mapping requested but not supported, skipping"));
+ log->info(Logr::Warning, "CPU mapping requested but not supported, skipping");
return result;
}
}
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Error parsing cpu-map entry '" << part << "': " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Error parsing cpu-map entry", "entry", Logging::Loggable(part)));
+ log->error(Logr::Error, e.what(), "Error parsing cpu-map entry", "entry", Logging::Loggable(part));
}
}
const auto cpusMap = parseCPUMap(log);
if (RecThreadInfo::numDistributors() + RecThreadInfo::numUDPWorkers() == 1) {
- SLOG(g_log << Logger::Warning << "Operating with single UDP distributor/worker thread" << endl,
- log->info(Logr::Notice, "Operating with single UDP distributor/worker thread"));
+ log->info(Logr::Notice, "Operating with single UDP distributor/worker thread");
/* This thread handles the web server, carbon, statistics and the control channel */
unsigned int currentThreadId = 0;
// And now start the actual threads
currentThreadId = 1;
if (RecThreadInfo::weDistributeQueries()) {
- SLOG(g_log << Logger::Warning << "Launching " << RecThreadInfo::numDistributors() << " distributor threads" << endl,
- log->info(Logr::Notice, "Launching distributor threads", "count", Logging::Loggable(RecThreadInfo::numDistributors())));
+ log->info(Logr::Notice, "Launching distributor threads", "count", Logging::Loggable(RecThreadInfo::numDistributors()));
for (unsigned int thread = 0; thread < RecThreadInfo::numDistributors(); thread++, currentThreadId++) {
auto& info = RecThreadInfo::info(currentThreadId);
info.start(currentThreadId, "distr", cpusMap, log);
}
}
- SLOG(g_log << Logger::Warning << "Launching " << RecThreadInfo::numUDPWorkers() << " worker threads" << endl,
- log->info(Logr::Notice, "Launching worker threads", "count", Logging::Loggable(RecThreadInfo::numUDPWorkers())));
+ log->info(Logr::Notice, "Launching worker threads", "count", Logging::Loggable(RecThreadInfo::numUDPWorkers()));
for (unsigned int thread = 0; thread < RecThreadInfo::numUDPWorkers(); thread++, currentThreadId++) {
auto& info = RecThreadInfo::info(currentThreadId);
info.start(currentThreadId, "worker", cpusMap, log);
}
- SLOG(g_log << Logger::Warning << "Launching " << RecThreadInfo::numTCPWorkers() << " tcpworker threads" << endl,
- log->info(Logr::Notice, "Launching tcpworker threads", "count", Logging::Loggable(RecThreadInfo::numTCPWorkers())));
+ log->info(Logr::Notice, "Launching tcpworker threads", "count", Logging::Loggable(RecThreadInfo::numTCPWorkers()));
for (unsigned int thread = 0; thread < RecThreadInfo::numTCPWorkers(); thread++, currentThreadId++) {
auto& info = RecThreadInfo::info(currentThreadId);
{
auto pipeBufferSize = ::arg().asNum("distribution-pipe-buffer-size");
if (pipeBufferSize > 0) {
- SLOG(g_log << Logger::Info << "Resizing the buffer of the distribution pipe to " << pipeBufferSize << endl,
- log->info(Logr::Info, "Resizing the buffer of the distribution pipe", "size", Logging::Loggable(pipeBufferSize)));
+ log->info(Logr::Info, "Resizing the buffer of the distribution pipe", "size", Logging::Loggable(pipeBufferSize));
}
/* thread 0 is the handler / SNMP, worker threads start at 1 */
if (pipeBufferSize > 0) {
if (!setPipeBufferSize(threadInfo.pipes.writeQueriesToThread, pipeBufferSize)) {
int err = errno;
- SLOG(g_log << Logger::Warning << "Error resizing the buffer of the distribution pipe for thread " << thread << " to " << pipeBufferSize << ": " << stringerror(err) << endl,
- log->error(Logr::Warning, err, "Error resizing the buffer of the distribution pipe for thread", "thread", Logging::Loggable(thread), "size", Logging::Loggable(pipeBufferSize)));
+ log->error(Logr::Warning, err, "Error resizing the buffer of the distribution pipe for thread", "thread", Logging::Loggable(thread), "size", Logging::Loggable(pipeBufferSize));
auto existingSize = getPipeBufferSize(threadInfo.pipes.writeQueriesToThread);
if (existingSize > 0) {
- SLOG(g_log << Logger::Warning << "The current size of the distribution pipe's buffer for thread " << thread << " is " << existingSize << endl,
- log->info(Logr::Warning, "The current size of the distribution pipe's buffer for thread", "thread", Logging::Loggable(thread), "size", Logging::Loggable(existingSize)));
+ log->info(Logr::Warning, "The current size of the distribution pipe's buffer for thread", "thread", Logging::Loggable(thread), "size", Logging::Loggable(existingSize));
}
}
}
return ret;
}
catch (FDMultiplexerException& fe) {
- SLOG(g_log << Logger::Warning << "Non-fatal error initializing possible multiplexer (" << fe.what() << "), falling back" << endl,
- log->error(Logr::Warning, fe.what(), "Non-fatal error initializing possible multiplexer, falling back"));
+ log->error(Logr::Warning, fe.what(), "Non-fatal error initializing possible multiplexer, falling back");
}
catch (...) {
- SLOG(g_log << Logger::Warning << "Non-fatal error initializing possible multiplexer" << endl,
- log->info(Logr::Warning, "Non-fatal error initializing possible multiplexer"));
+ log->info(Logr::Warning, "Non-fatal error initializing possible multiplexer");
}
}
- SLOG(g_log << Logger::Error << "No working multiplexer found!" << endl,
- log->info(Logr::Error, "No working multiplexer found!"));
+ log->info(Logr::Error, "No working multiplexer found!");
_exit(1);
}
result->emplace_back(std::move(logger));
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Error while starting protobuf logger to '" << server << ": " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while starting protobuf logger", "exception", Logging::Loggable("std::exception"), "server", Logging::Loggable(server)));
+ log->error(Logr::Error, e.what(), "Exception while starting protobuf logger", "exception", Logging::Loggable("std::exception"), "server", Logging::Loggable(server));
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error while starting protobuf logger to '" << server << ": " << e.reason << endl,
- log->error(Logr::Error, e.reason, "Exception while starting protobuf logger", "exception", Logging::Loggable("PDNSException"), "server", Logging::Loggable(server)));
+ log->error(Logr::Error, e.reason, "Exception while starting protobuf logger", "exception", Logging::Loggable("PDNSException"), "server", Logging::Loggable(server));
}
}
result->emplace_back(std::move(fsl));
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Error while starting dnstap framestream logger to '" << server << ": " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while starting dnstap framestream logger", "exception", Logging::Loggable("std::exception"), "server", Logging::Loggable(server)));
+ log->error(Logr::Error, e.what(), "Exception while starting dnstap framestream logger", "exception", Logging::Loggable("std::exception"), "server", Logging::Loggable(server));
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error while starting dnstap framestream logger to '" << server << ": " << e.reason << endl,
- log->error(Logr::Error, e.reason, "Exception while starting dnstap framestream logger", "exception", Logging::Loggable("PDNSException"), "server", Logging::Loggable(server)));
+ log->error(Logr::Error, e.reason, "Exception while starting dnstap framestream logger", "exception", Logging::Loggable("PDNSException"), "server", Logging::Loggable(server));
}
}
}
else {
int err = errno;
- SLOG(g_log << Logger::Error << "Writing pid for " << Utility::getpid() << " to " << g_pidfname << " failed: " << stringerror(err) << endl,
- log->error(Logr::Error, err, "Writing pid failed", "pid", Logging::Loggable(Utility::getpid()), "file", Logging::Loggable(g_pidfname)));
+ log->error(Logr::Error, err, "Writing pid failed", "pid", Logging::Loggable(Utility::getpid()), "file", Logging::Loggable(g_pidfname));
}
}
return;
}
dir = ::arg()["chroot"] + dir;
- SLOG(g_log << Logger::Error << "Problem with socket directory " << dir << ": " << msg << "; see https://docs.powerdns.com/recursor/upgrade.html#x-to-4-3-0" << endl,
- log->error(Logr::Error, msg, "Problem with socket directory, see https://docs.powerdns.com/recursor/upgrade.html#x-to-4-3-0", "dir", Logging::Loggable(dir)));
+ log->error(Logr::Error, msg, "Problem with socket directory, see https://docs.powerdns.com/recursor/upgrade.html#x-to-4-3-0", "dir", Logging::Loggable(dir));
_exit(1);
}
g_nodDBp->setCacheDir(::arg()["new-domain-history-dir"]);
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "new-domain-history-dir (" << ::arg()["new-domain-history-dir"] << ") is not readable or does not exist" << endl,
- log->error(Logr::Error, e.reason, "new-domain-history-dir is not readable or does not exists", "dir", Logging::Loggable(::arg()["new-domain-history-dir"])));
+ log->error(Logr::Error, e.reason, "new-domain-history-dir is not readable or does not exists", "dir", Logging::Loggable(::arg()["new-domain-history-dir"]));
_exit(1);
}
if (!g_nodDBp->init()) {
- SLOG(g_log << Logger::Error << "Could not initialize domain tracking" << endl,
- log->info(Logr::Error, "Could not initialize domain tracking"));
+ log->info(Logr::Error, "Could not initialize domain tracking");
_exit(1);
}
if (::arg().asNum("new-domain-db-snapshot-interval") > 0) {
g_udrDBp->setCacheDir(::arg()["unique-response-history-dir"]);
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "unique-response-history-dir (" << ::arg()["unique-response-history-dir"] << ") is not readable or does not exist" << endl,
- log->info(Logr::Error, "unique-response-history-dir is not readable or does not exist", "dir", Logging::Loggable(::arg()["unique-response-history-dir"])));
+ log->info(Logr::Error, "unique-response-history-dir is not readable or does not exist", "dir", Logging::Loggable(::arg()["unique-response-history-dir"]));
_exit(1);
}
if (!g_udrDBp->init()) {
- SLOG(g_log << Logger::Error << "Could not initialize unique response tracking" << endl,
- log->info(Logr::Error, "Could not initialize unique response tracking"));
+ log->info(Logr::Error, "Could not initialize unique response tracking");
_exit(1);
}
if (::arg().asNum("new-domain-db-snapshot-interval") > 0) {
matchNode.add(DNSName(line));
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Ignoring line of ignorelist due to an error: " << e.what() << endl,
- g_slog->withName("config")->error(Logr::Warning, e.what(), "Ignoring line of ignorelist due to an error", "exception", Logging::Loggable("std::exception")));
+ g_slog->withName("config")->error(Logr::Warning, e.what(), "Ignoring line of ignorelist due to an error", "exception", Logging::Loggable("std::exception"));
}
}
}
if (auto pid = fork(); pid != 0) {
if (pid < 0) {
int err = errno;
- SLOG(g_log << Logger::Critical << "Fork failed: " << stringerror(err) << endl,
- log->error(Logr::Critical, err, "Fork failed"));
+ log->error(Logr::Critical, err, "Fork failed");
exit(1); // NOLINT(concurrency-mt-unsafe)
}
exit(0); // NOLINT(concurrency-mt-unsafe)
int devNull = open("/dev/null", O_RDWR); /* open stdin */
if (devNull < 0) {
int err = errno;
- SLOG(g_log << Logger::Critical << "Unable to open /dev/null: " << stringerror(err) << endl,
- log->error(Logr::Critical, err, "Unable to open /dev/null"));
+ log->error(Logr::Critical, err, "Unable to open /dev/null");
}
else {
dup2(devNull, 0); /* stdin */
if (readFileIfThere("/proc/sys/net/ipv6/route/max_size", &line)) {
int lim = std::stoi(line);
if (lim < 16384) {
- SLOG(g_log << Logger::Error << "If using IPv6, please raise sysctl net.ipv6.route.max_size, currently set to " << lim << " which is < 16384" << endl,
- log->info(Logr::Error, "If using IPv6, please raise sysctl net.ipv6.route.max_size to a size >= 16384", "current", Logging::Loggable(lim)));
+ log->info(Logr::Error, "If using IPv6, please raise sysctl net.ipv6.route.max_size to a size >= 16384", "current", Logging::Loggable(lim));
}
}
#endif
auto mapsNeeded = 4ULL * g_maxMThreads * workers;
if (lim < mapsNeeded) {
g_maxMThreads = static_cast<unsigned int>(lim / (4ULL * workers));
- SLOG(g_log << Logger::Error << "sysctl vm.max_map_count= <" << mapsNeeded << ", this may cause 'bad_alloc' exceptions; adjusting max-mthreads to " << g_maxMThreads << endl,
- log->info(Logr::Error, "sysctl vm.max_map_count < mapsNeeded, this may cause 'bad_alloc' exceptions, adjusting max-mthreads",
- "vm.max_map_count", Logging::Loggable(lim), "mapsNeeded", Logging::Loggable(mapsNeeded),
- "max-mthreads", Logging::Loggable(g_maxMThreads)));
+ log->info(Logr::Error, "sysctl vm.max_map_count < mapsNeeded, this may cause 'bad_alloc' exceptions, adjusting max-mthreads",
+ "vm.max_map_count", Logging::Loggable(lim), "mapsNeeded", Logging::Loggable(mapsNeeded),
+ "max-mthreads", Logging::Loggable(g_maxMThreads));
}
}
#endif
result->addMask(line);
}
}
- SLOG(g_log << Logger::Info << "Done parsing " << result->size() << " " << aclSetting << " ranges from file '" << file << "' - overriding '" << aclSetting << "' setting" << endl,
- log->info(Logr::Info, "Done parsing ranges from file, will override setting", "setting", Logging::Loggable(aclSetting),
- "number", Logging::Loggable(result->size()), "file", Logging::Loggable(file)));
+ log->info(Logr::Info, "Done parsing ranges from file, will override setting", "setting", Logging::Loggable(aclSetting),
+ "number", Logging::Loggable(result->size()), "file", Logging::Loggable(file));
}
else if (!::arg()[aclSetting].empty()) {
vector<string> ips;
if (allowFrom->empty()) {
if (::arg()["local-address"] != "127.0.0.1" && ::arg().asNum("local-port") == 53) {
- SLOG(g_log << Logger::Warning << "WARNING: Allowing queries from all IP addresses - this can be a security risk!" << endl,
- log->info(Logr::Warning, "WARNING: Allowing queries from all IP addresses - this can be a security risk!"));
+ log->info(Logr::Warning, "WARNING: Allowing queries from all IP addresses - this can be a security risk!");
}
allowFrom = nullptr;
}
pdns::parseQueryLocalAddress(::arg()["query-local-address"]);
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Assigning local query addresses: " << e.what(),
- log->error(Logr::Error, e.what(), "Unable to assign local query address"));
+ log->error(Logr::Error, e.what(), "Unable to assign local query address");
return 99;
}
if (pdns::isQueryLocalAddressFamilyEnabled(AF_INET)) {
SyncRes::s_doIPv4 = true;
- SLOG(g_log << Logger::Warning << "Enabling IPv4 transport for outgoing queries" << endl,
- log->info(Logr::Notice, "Enabling IPv4 transport for outgoing queries"));
+ log->info(Logr::Notice, "Enabling IPv4 transport for outgoing queries");
}
else {
- SLOG(g_log << Logger::Warning << "NOT using IPv4 for outgoing queries - add an IPv4 address (like '0.0.0.0') to query-local-address to enable" << endl,
- log->info(Logr::Warning, "NOT using IPv4 for outgoing queries - add an IPv4 address (like '0.0.0.0') to query-local-address to enable"));
+ log->info(Logr::Warning, "NOT using IPv4 for outgoing queries - add an IPv4 address (like '0.0.0.0') to query-local-address to enable");
}
if (pdns::isQueryLocalAddressFamilyEnabled(AF_INET6)) {
SyncRes::s_doIPv6 = true;
- SLOG(g_log << Logger::Warning << "Enabling IPv6 transport for outgoing queries" << endl,
- log->info(Logr::Notice, "Enabling IPv6 transport for outgoing queries"));
+ log->info(Logr::Notice, "Enabling IPv6 transport for outgoing queries");
}
else {
- SLOG(g_log << Logger::Warning << "NOT using IPv6 for outgoing queries - add an IPv6 address (like '::') to query-local-address to enable" << endl,
- log->info(Logr::Warning, "NOT using IPv6 for outgoing queries - add an IPv6 address (like '::') to query-local-address to enable"));
+ log->info(Logr::Warning, "NOT using IPv6 for outgoing queries - add an IPv6 address (like '::') to query-local-address to enable");
}
if (!SyncRes::s_doIPv6 && !SyncRes::s_doIPv4) {
- SLOG(g_log << Logger::Error << "No outgoing addresses configured! Can not continue" << endl,
- log->info(Logr::Error, "No outgoing addresses configured! Can not continue"));
+ log->info(Logr::Error, "No outgoing addresses configured! Can not continue");
return 99;
}
return 0;
g_dnssecmode = DNSSECMode::ValidateForLog;
}
else {
- SLOG(g_log << Logger::Error << "Unknown DNSSEC mode " << ::arg()["dnssec"] << endl,
- log->info(Logr::Error, "Unknown DNSSEC mode", "dnssec", Logging::Loggable(::arg()["dnssec"])));
+ log->info(Logr::Error, "Unknown DNSSEC mode", "dnssec", Logging::Loggable(::arg()["dnssec"]));
return 1;
}
{
uint64_t sse = ::arg().asNum("serve-stale-extensions");
if (sse > std::numeric_limits<uint16_t>::max()) {
- SLOG(g_log << Logger::Error << "Illegal serve-stale-extensions value: " << sse << "; range = 0..65536" << endl,
- log->info(Logr::Error, "Illegal serve-stale-extensions value; range = 0..65536", "value", Logging::Loggable(sse)));
+ log->info(Logr::Error, "Illegal serve-stale-extensions value; range = 0..65536", "value", Logging::Loggable(sse));
return 1;
}
MemRecursorCache::s_maxServedStaleExtensions = sse;
SyncRes::s_hardenNXD = SyncRes::HardenNXD::No;
}
else if (value != "dnssec") {
- SLOG(g_log << Logger::Error << "Unknown nothing-below-nxdomain mode: " << value << endl,
- log->info(Logr::Error, "Unknown nothing-below-nxdomain mode", "mode", Logging::Loggable(value)));
+ log->info(Logr::Error, "Unknown nothing-below-nxdomain mode", "mode", Logging::Loggable(value));
return 1;
}
g_balancingFactor = ::arg().asDouble("distribution-load-factor");
if (g_balancingFactor != 0.0 && g_balancingFactor < 1.0) {
g_balancingFactor = 0.0;
- SLOG(g_log << Logger::Warning << "Asked to run with a distribution-load-factor below 1.0, disabling it instead" << endl,
- log->info(Logr::Warning, "Asked to run with a distribution-load-factor below 1.0, disabling it instead"));
+ log->info(Logr::Warning, "Asked to run with a distribution-load-factor below 1.0, disabling it instead");
}
#ifdef SO_REUSEPORT
}
if (::arg().mustDo("daemon")) {
- SLOG(g_log << Logger::Warning << "Calling daemonize, going to background" << endl,
- log->info(Logr::Warning, "Calling daemonize, going to background"));
+ log->info(Logr::Warning, "Calling daemonize, going to background");
g_log.toConsole(Logger::Critical);
daemonize(log);
}
{
int port = ::arg().asNum("udp-source-port-min");
if (port < 1024 || port > 65535) {
- SLOG(g_log << Logger::Error << "Unable to launch, udp-source-port-min is not a valid port number" << endl,
- log->info(Logr::Error, "Unable to launch, udp-source-port-min is not a valid port number"));
+ log->info(Logr::Error, "Unable to launch, udp-source-port-min is not a valid port number");
return 99; // this isn't going to fix itself either
}
g_minUdpSourcePort = port;
port = ::arg().asNum("udp-source-port-max");
if (port < 1024 || port > 65535 || port < g_minUdpSourcePort) {
- SLOG(g_log << Logger::Error << "Unable to launch, udp-source-port-max is not a valid port number or is smaller than udp-source-port-min" << endl,
- log->info(Logr::Error, "Unable to launch, udp-source-port-max is not a valid port number or is smaller than udp-source-port-min"));
+ log->info(Logr::Error, "Unable to launch, udp-source-port-max is not a valid port number or is smaller than udp-source-port-min");
return 99; // this isn't going to fix itself either
}
g_maxUdpSourcePort = port;
for (const auto& part : parts) {
port = std::stoi(part);
if (port < 1024 || port > 65535) {
- SLOG(g_log << Logger::Error << "Unable to launch, udp-source-port-avoid contains an invalid port number: " << part << endl,
- log->info(Logr::Error, "Unable to launch, udp-source-port-avoid contains an invalid port number", "port", Logging::Loggable(part)));
+ log->info(Logr::Error, "Unable to launch, udp-source-port-avoid contains an invalid port number", "port", Logging::Loggable(part));
return 99; // this isn't going to fix itself either
}
g_avoidUdpSourcePorts.insert(port);
g_snmpAgent->run();
#else
const std::string msg = "snmp-agent set but SNMP support not compiled in";
- SLOG(g_log << Logger::Error << msg << endl,
- log->info(Logr::Error, msg));
+ log->info(Logr::Error, msg);
#endif // HAVE_NET_SNMP
}
}
char* ns;
ns = getenv("NOTIFY_SOCKET");
if (ns != nullptr) {
- SLOG(g_log << Logger::Error << "Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'" << endl,
- log->info(Logr::Error, "Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'"));
+ log->info(Logr::Error, "Unable to chroot when running from systemd. Please disable chroot= or set the 'Type' for this service to 'simple'");
return 1;
}
#endif
if (chroot(::arg()["chroot"].c_str()) < 0 || chdir("/") < 0) {
int err = errno;
- SLOG(g_log << Logger::Error << "Unable to chroot to '" + ::arg()["chroot"] + "': " << stringerror(err) << ", exiting" << endl,
- log->error(Logr::Error, err, "Unable to chroot", "chroot", Logging::Loggable(::arg()["chroot"])));
+ log->error(Logr::Error, err, "Unable to chroot", "chroot", Logging::Loggable(::arg()["chroot"]));
return 1;
}
- SLOG(g_log << Logger::Info << "Chrooted to '" << ::arg()["chroot"] << "'" << endl,
- log->info(Logr::Info, "Chrooted", "chroot", Logging::Loggable(::arg()["chroot"])));
+ log->info(Logr::Info, "Chrooted", "chroot", Logging::Loggable(::arg()["chroot"]));
}
checkSocketDir(log);
dropCapabilities();
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << e.what() << endl,
- log->error(Logr::Warning, e.what(), "Could not drop capabilities"));
+ log->error(Logr::Warning, e.what(), "Could not drop capabilities");
}
return 0;
}
stringtok(parts, ::arg()["dot-to-auth-names"], " ,");
#ifndef HAVE_DNS_OVER_TLS
if (!parts.empty()) {
- SLOG(g_log << Logger::Error << "dot-to-auth-names setting contains names, but Recursor was built without DNS over TLS support. Setting will be ignored." << endl,
- log->info(Logr::Error, "dot-to-auth-names setting contains names, but Recursor was built without DNS over TLS support. Setting will be ignored"));
+ log->info(Logr::Error, "dot-to-auth-names setting contains names, but Recursor was built without DNS over TLS support. Setting will be ignored");
}
#endif
for (const auto& part : parts) {
try {
auto dns64Prefix = Netmask(::arg()["dns64-prefix"]);
if (dns64Prefix.getBits() != 96) {
- SLOG(g_log << Logger::Error << "Invalid prefix for 'dns64-prefix', the current implementation only supports /96 prefixes: " << ::arg()["dns64-prefix"] << endl,
- log->info(Logr::Error, "Invalid prefix for 'dns64-prefix', the current implementation only supports /96 prefixes", "prefix", Logging::Loggable(::arg()["dns64-prefix"])));
+ log->info(Logr::Error, "Invalid prefix for 'dns64-prefix', the current implementation only supports /96 prefixes", "prefix", Logging::Loggable(::arg()["dns64-prefix"]));
return 1;
}
g_dns64Prefix = dns64Prefix.getNetwork();
}
}
catch (const NetmaskException& ne) {
- SLOG(g_log << Logger::Error << "Invalid prefix '" << ::arg()["dns64-prefix"] << "' for 'dns64-prefix': " << ne.reason << endl,
- log->info(Logr::Error, "Invalid prefix", "dns64-prefix", Logging::Loggable(::arg()["dns64-prefix"])));
+ log->info(Logr::Error, "Invalid prefix", "dns64-prefix", Logging::Loggable(::arg()["dns64-prefix"]));
return 1;
}
}
g_log.setFacility(val);
}
else {
- SLOG(g_log << Logger::Error << "Unknown logging facility " << ::arg().asNum("logging-facility") << endl,
- log->info(Logr::Error, "Unknown logging facility", "facility", Logging::Loggable(::arg().asNum("logging-facility"))));
+ log->info(Logr::Error, "Unknown logging facility", "facility", Logging::Loggable(::arg().asNum("logging-facility")));
}
}
auto luaResult = luaconfig(false);
if (luaResult.d_ret != 0) {
- SLOG(g_log << Logger::Error << "Cannot load Lua or equivalent YAML configuration: " << luaResult.d_str << endl,
- log->error(Logr::Error, luaResult.d_str, "Cannot load Lua or equivalent YAML configuration"));
+ log->error(Logr::Error, luaResult.d_str, "Cannot load Lua or equivalent YAML configuration");
return 1;
}
RecThreadInfo::setWeDistributeQueries(::arg().mustDo("pdns-distributes-queries"));
if (RecThreadInfo::weDistributeQueries()) {
- SLOG(g_log << Logger::Warning << "PowerDNS Recursor itself will distribute queries over threads" << endl,
- log->info(Logr::Notice, "PowerDNS Recursor itself will distribute queries over threads"));
+ log->info(Logr::Notice, "PowerDNS Recursor itself will distribute queries over threads");
}
g_outgoingEDNSBufsize = ::arg().asNum("edns-outgoing-bufsize");
g_paddingMode = PaddingMode::PaddedQueries;
}
else {
- SLOG(g_log << Logger::Error << "Unknown edns-padding-mode: " << ::arg()["edns-padding-mode"] << endl,
- log->info(Logr::Error, "Unknown edns-padding-mode", "edns-padding-mode", Logging::Loggable(::arg()["edns-padding-mode"])));
+ log->info(Logr::Error, "Unknown edns-padding-mode", "edns-padding-mode", Logging::Loggable(::arg()["edns-padding-mode"]));
return 1;
}
g_paddingTag = ::arg().asNum("edns-padding-tag");
RecThreadInfo::setNumDistributorThreads(::arg().asNum("distributor-threads"));
RecThreadInfo::setNumUDPWorkerThreads(::arg().asNum("threads"));
if (RecThreadInfo::numUDPWorkers() < 1) {
- SLOG(g_log << Logger::Warning << "Asked to run with 0 threads, raising to 1 instead" << endl,
- log->info(Logr::Warning, "Asked to run with 0 threads, raising to 1 instead"));
+ log->info(Logr::Warning, "Asked to run with 0 threads, raising to 1 instead");
RecThreadInfo::setNumUDPWorkerThreads(1);
}
RecThreadInfo::setNumTCPWorkerThreads(::arg().asNum("tcp-threads"));
if (RecThreadInfo::numTCPWorkers() < 1) {
- SLOG(g_log << Logger::Warning << "Asked to run with 0 TCP threads, raising to 1 instead" << endl,
- log->info(Logr::Warning, "Asked to run with 0 TCP threads, raising to 1 instead"));
+ log->info(Logr::Warning, "Asked to run with 0 TCP threads, raising to 1 instead");
RecThreadInfo::setNumTCPWorkerThreads(1);
}
int64_t maxInFlight = ::arg().asNum("max-concurrent-requests-per-tcp-connection");
if (maxInFlight < 1 || maxInFlight > USHRT_MAX || maxInFlight >= g_maxMThreads) {
- SLOG(g_log << Logger::Warning << "Asked to run with illegal max-concurrent-requests-per-tcp-connection, setting to default (10)" << endl,
- log->info(Logr::Warning, "Asked to run with illegal max-concurrent-requests-per-tcp-connection, setting to default (10)"));
+ log->info(Logr::Warning, "Asked to run with illegal max-concurrent-requests-per-tcp-connection, setting to default (10)");
TCPConnection::s_maxInFlight = 10;
}
else {
g_aggressiveNSECCache = make_unique<AggressiveNSECCache>(::arg().asNum("aggressive-nsec-cache-size"));
}
else {
- SLOG(g_log << Logger::Warning << "Aggressive NSEC/NSEC3 caching is enabled but DNSSEC validation is not set to 'validate', 'log-fail' or 'process', ignoring" << endl,
- log->info(Logr::Warning, "Aggressive NSEC/NSEC3 caching is enabled but DNSSEC validation is not set to 'validate', 'log-fail' or 'process', ignoring"));
+ log->info(Logr::Warning, "Aggressive NSEC/NSEC3 caching is enabled but DNSSEC validation is not set to 'validate', 'log-fail' or 'process', ignoring");
}
}
AggressiveNSECCache::s_nsec3DenialProofMaxCost = ::arg().asNum("aggressive-cache-max-nsec3-hash-cost");
AggressiveNSECCache::s_maxNSEC3CommonPrefix = static_cast<uint8_t>(std::round(std::log2(::arg().asNum("aggressive-cache-min-nsec3-hit-ratio"))));
- SLOG(g_log << Logger::Debug << "NSEC3 aggressive cache tuning: aggressive-cache-min-nsec3-hit-ratio: " << ::arg().asNum("aggressive-cache-min-nsec3-hit-ratio") << " max common prefix bits: " << std::to_string(AggressiveNSECCache::s_maxNSEC3CommonPrefix) << endl,
- log->info(Logr::Debug, "NSEC3 aggressive cache tuning", "aggressive-cache-min-nsec3-hit-ratio", Logging::Loggable(::arg().asNum("aggressive-cache-min-nsec3-hit-ratio")), "maxCommonPrefixBits", Logging::Loggable(AggressiveNSECCache::s_maxNSEC3CommonPrefix)));
+ log->info(Logr::Debug, "NSEC3 aggressive cache tuning", "aggressive-cache-min-nsec3-hit-ratio", Logging::Loggable(::arg().asNum("aggressive-cache-min-nsec3-hit-ratio")), "maxCommonPrefixBits", Logging::Loggable(AggressiveNSECCache::s_maxNSEC3CommonPrefix));
initSuffixMatchNodes(log);
initCarbon();
#ifdef HAVE_LIBSODIUM
if (sodium_init() == -1) {
- SLOG(g_log << Logger::Error << "Unable to initialize sodium crypto library" << endl,
- log->info(Logr::Error, "Unable to initialize sodium crypto library"));
+ log->info(Logr::Error, "Unable to initialize sodium crypto library");
return 99;
}
#endif
throw PDNSException("accept failed");
}
string msg = g_rcc.recv(clientfd).d_str;
- SLOG(g_log << Logger::Info << "Received rec_control command '" << msg << "' via controlsocket" << endl,
- log->info(Logr::Info, "Received rec_control command via control socket", "command", Logging::Loggable(msg)));
+ log->info(Logr::Info, "Received rec_control command via control socket", "command", Logging::Loggable(msg));
RecursorControlParser::func_t* command = nullptr;
auto answer = RecursorControlParser::getAnswer(clientfd, msg, &command);
}
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Error dealing with control socket request: " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while dealing with control socket request", "exception", Logging::Loggable("std::exception")));
+ log->error(Logr::Error, e.what(), "Exception while dealing with control socket request", "exception", Logging::Loggable("std::exception"));
}
catch (const PDNSException& ae) {
- SLOG(g_log << Logger::Error << "Error dealing with control socket request: " << ae.reason << endl,
- log->error(Logr::Error, ae.reason, "Exception while dealing with control socket request", "exception", Logging::Loggable("PDNSException")));
+ log->error(Logr::Error, ae.reason, "Exception while dealing with control socket request", "exception", Logging::Loggable("PDNSException"));
}
}
doSecPoll(&t_last_secpoll, log);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Exception while performing security poll: " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while performing security poll"));
+ log->error(Logr::Error, e.what(), "Exception while performing security poll");
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Exception while performing security poll: " << e.reason << endl,
- log->error(Logr::Error, e.reason, "Exception while performing security poll"));
+ log->error(Logr::Error, e.reason, "Exception while performing security poll");
}
catch (const ImmediateServFailException& e) {
- SLOG(g_log << Logger::Error << "Exception while performing security poll: " << e.reason << endl,
- log->error(Logr::Error, e.reason, "Exception while performing security poll"));
+ log->error(Logr::Error, e.reason, "Exception while performing security poll");
}
catch (const PolicyHitException& e) {
- SLOG(g_log << Logger::Error << "Policy hit while performing security poll" << endl,
- log->info(Logr::Error, "Policy hit while performing security poll"));
+ log->info(Logr::Error, "Policy hit while performing security poll");
}
catch (...) {
- SLOG(g_log << Logger::Error << "Exception while performing security poll" << endl,
- log->info(Logr::Error, "Exception while performing security poll"));
+ log->info(Logr::Error, "Exception while performing security poll");
}
});
trustAnchorTask.setPeriod(taInterval);
trustAnchorTask.runIfDue(now, [&luaconfsLocal, &log]() {
if (!luaconfsLocal->trustAnchorFileInfo.fname.empty() && luaconfsLocal->trustAnchorFileInfo.interval != 0) {
- SLOG(g_log << Logger::Debug << "Refreshing Trust Anchors from file" << endl,
- log->info(Logr::Debug, "Refreshing Trust Anchors from file"));
+ log->info(Logr::Debug, "Refreshing Trust Anchors from file");
try {
map<DNSName, dsset_t> dsAnchors;
if (updateTrustAnchorsFromFile(luaconfsLocal->trustAnchorFileInfo.fname, dsAnchors, log)) {
}
}
catch (const PDNSException& pe) {
- SLOG(g_log << Logger::Error << "Unable to update Trust Anchors: " << pe.reason << endl,
- log->error(Logr::Error, pe.reason, "Unable to update Trust Anchors"));
+ log->error(Logr::Error, pe.reason, "Unable to update Trust Anchors");
}
}
});
}
catch (const PDNSException& ae) {
t_running = false;
- SLOG(g_log << Logger::Error << "Fatal error in housekeeping thread: " << ae.reason << endl,
- log->error(Logr::Error, ae.reason, "Fatal error in housekeeping thread"));
+ log->error(Logr::Error, ae.reason, "Fatal error in housekeeping thread");
throw;
}
catch (...) {
t_running = false;
- SLOG(g_log << Logger::Error << "Uncaught exception in housekeeping thread" << endl,
- log->info(Logr::Error, "Uncaught exception in housekeeping thread"));
+ log->info(Logr::Error, "Uncaught exception in housekeeping thread");
throw;
}
}
for (const auto& exp : expired) {
auto conn = boost::any_cast<shared_ptr<TCPConnection>>(exp.second);
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Warning << "Timeout from remote TCP client " << conn->d_remote.toStringWithPort() << endl,
- g_slogtcpin->info(Logr::Warning, "Timeout from remote TCP client", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Warning, "Timeout from remote TCP client", "remote", Logging::Loggable(conn->d_remote));
}
t_fdm->removeReadFD(exp.first);
}
if (!primeHints()) {
threadInfo.setExitCode(EXIT_FAILURE);
RecursorControlChannel::stop = true;
- SLOG(g_log << Logger::Critical << "Priming cache failed, stopping" << endl,
- log->info(Logr::Critical, "Priming cache failed, stopping"));
+ log->info(Logr::Critical, "Priming cache failed, stopping");
}
- SLOG(g_log << Logger::Debug << "Done priming cache with root hints" << endl,
- log->info(Logr::Debug, "Done priming cache with root hints"));
+ log->info(Logr::Debug, "Done priming cache with root hints");
}
}
if (!::arg()["lua-dns-script"].empty()) {
t_pdl = std::make_shared<RecursorLua4>();
t_pdl->loadFile(::arg()["lua-dns-script"]);
- SLOG(g_log << Logger::Warning << "Loaded 'lua' script from '" << ::arg()["lua-dns-script"] << "'" << endl,
- log->info(Logr::Warning, "Loading Lua script from file", "name", Logging::Loggable(::arg()["lua-dns-script"])));
+ log->info(Logr::Warning, "Loading Lua script from file", "name", Logging::Loggable(::arg()["lua-dns-script"]));
}
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << "Failed to load 'lua' script from '" << ::arg()["lua-dns-script"] << "': " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Failed to load Lua script from file", "name", Logging::Loggable(::arg()["lua-dns-script"])));
+ log->error(Logr::Error, e.what(), "Failed to load Lua script from file", "name", Logging::Loggable(::arg()["lua-dns-script"]));
_exit(99);
}
}
t_fdm->addReadFD(threadInfo.getPipes().readToThread, handlePipeRequest);
if (threadInfo.isHandler()) {
- SLOG(g_log << Logger::Info << "Enabled '" << t_fdm->getName() << "' multiplexer" << endl,
- log->info(Logr::Info, "Enabled multiplexer", "name", Logging::Loggable(t_fdm->getName())));
+ log->info(Logr::Info, "Enabled multiplexer", "name", Logging::Loggable(t_fdm->getName()));
}
else {
t_fdm->addReadFD(threadInfo.getPipes().readQueriesToThread, handlePipeRequest);
recLoop();
}
catch (const PDNSException& ae) {
- SLOG(g_log << Logger::Error << "Exception: " << ae.reason << endl,
- log->error(Logr::Error, ae.reason, "Exception in RecursorThread", "exception", Logging::Loggable("PDNSException")));
+ log->error(Logr::Error, ae.reason, "Exception in RecursorThread", "exception", Logging::Loggable("PDNSException"));
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "STL Exception: " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception in RecursorThread", "exception", Logging::Loggable("std::exception")));
+ log->error(Logr::Error, e.what(), "Exception in RecursorThread", "exception", Logging::Loggable("std::exception"));
}
catch (...) {
- SLOG(g_log << Logger::Error << "any other exception in main: " << endl,
- log->info(Logr::Error, "Exception in RecursorThread"));
+ log->info(Logr::Error, "Exception in RecursorThread");
}
}
if (config == "check") {
try {
if (!::arg().file(configname)) {
- SLOG(g_log << Logger::Warning << "Unable to open configuration file '" << configname << "'" << endl,
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname)));
+ startupLog->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) {
- SLOG(g_log << Logger::Warning << "Unable to parse configuration file '" << configname << "': " << argException.reason << endl,
- startupLog->error("Cannot parse configuration", "Unable to parse configuration file", "config_file", Logging::Loggable(configname), "reason", Logging::Loggable(argException.reason)));
+ startupLog->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)) {
- SLOG(g_log << Logger::Warning << "Unable to open configuration file '" << configname << "'" << endl,
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname)));
+ startupLog->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)) {
- SLOG(g_log << Logger::Warning << "Unable to open configuration file '" << configname << "'" << endl,
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname)));
+ startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
return {1, true};
}
::arg().laxParse(argc, argv);
if (::arg()["server-id"] == RUNTIME) { // i.e. not set explicitly
auto myHostname = getHostname();
if (!myHostname.has_value()) {
- SLOG(g_log << Logger::Warning << "Unable to get the hostname, NSID and id.server values will be empty" << endl,
- log->info(Logr::Warning, "Unable to get the hostname, NSID and id.server values will be empty"));
+ log->info(Logr::Warning, "Unable to get the hostname, NSID and id.server values will be empty");
}
::arg().set("server-id") = myHostname.has_value() ? *myHostname : "";
}
if (::arg().asNum("threads") == 1) {
if (::arg().mustDo("pdns-distributes-queries")) {
- SLOG(g_log << Logger::Warning << "Only one thread, no need to distribute queries ourselves" << endl,
- log->info(Logr::Warning, "Only one thread, no need to distribute queries ourselves"));
+ log->info(Logr::Warning, "Only one thread, no need to distribute queries ourselves");
::arg().set("pdns-distributes-queries") = "no";
}
}
if (::arg().mustDo("pdns-distributes-queries") && ::arg().asNum("distributor-threads") == 0) {
- SLOG(g_log << Logger::Warning << "Asked to run with pdns-distributes-queries set but no distributor threads, raising to 1" << endl,
- log->info(Logr::Warning, "Asked to run with pdns-distributes-queries set but no distributor threads, raising to 1"));
+ log->info(Logr::Warning, "Asked to run with pdns-distributes-queries set but no distributor threads, raising to 1");
::arg().set("distributor-threads") = "1";
}
if (!::arg().mustDo("pdns-distributes-queries") && ::arg().asNum("distributor-threads") > 0) {
- SLOG(g_log << Logger::Warning << "Not distributing queries, setting distributor threads to 0" << endl,
- log->info(Logr::Warning, "Not distributing queries, setting distributor threads to 0"));
+ log->info(Logr::Warning, "Not distributing queries, setting distributor threads to 0");
::arg().set("distributor-threads") = "0";
}
}
return ret;
}
if (!::arg().file(configname)) {
- SLOG(g_log << Logger::Warning << "Unable to open configuration file '" << configname << "'" << endl,
- startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname)));
+ startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname));
}
else {
if (!::arg().mustDo("enable-old-settings")) {
g_log.toConsole(s_logUrgency);
if (!::arg()["chroot"].empty() && !::arg()["api-config-dir"].empty()) {
- SLOG(g_log << Logger::Error << "Using chroot and enabling the API is not possible" << endl,
- startupLog->info(Logr::Error, "Cannot use chroot and enable the API at the same time"));
+ startupLog->info(Logr::Error, "Cannot use chroot and enable the API at the same time");
return EXIT_FAILURE;
}
RecThreadInfo::joinThread0();
}
catch (const PDNSException& ae) {
- SLOG(g_log << Logger::Error << "Exception: " << ae.reason << endl,
- g_slog->withName("config")->error(Logr::Critical, ae.reason, "Fatal error", "exception", Logging::Loggable("PDNSException")));
+ g_slog->withName("config")->error(Logr::Critical, ae.reason, "Fatal error", "exception", Logging::Loggable("PDNSException"));
ret = EXIT_FAILURE;
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "STL Exception: " << e.what() << endl,
- g_slog->withName("config")->error(Logr::Critical, e.what(), "Fatal error", "exception", Logging::Loggable("std::exception")));
+ g_slog->withName("config")->error(Logr::Critical, e.what(), "Fatal error", "exception", Logging::Loggable("std::exception"));
ret = EXIT_FAILURE;
}
catch (...) {
- SLOG(g_log << Logger::Error << "any other exception in main: " << endl,
- g_slog->withName("config")->info(Logr::Critical, "Fatal error"));
+ g_slog->withName("config")->info(Logr::Critical, "Fatal error");
ret = EXIT_FAILURE;
}
try {
if (fname.empty()) {
t_pdl.reset();
- SLOG(g_log << Logger::Info << RecThreadInfo::id() << " Unloaded current lua script" << endl,
- log->info(Logr::Info, "Unloaded current lua script"));
+ log->info(Logr::Info, "Unloaded current lua script");
return new RecursorControlChannel::Answer{0, string("unloaded\n")};
}
}
catch (std::runtime_error& ex) {
string msg = std::to_string(RecThreadInfo::thread_local_id()) + " Retaining current script, could not read '" + fname + "': " + ex.what();
- SLOG(g_log << Logger::Error << msg << endl,
- log->error(Logr::Error, ex.what(), "Retaining current script, could not read new script"));
+ log->error(Logr::Error, ex.what(), "Retaining current script, could not read new script");
return new RecursorControlChannel::Answer{1, msg + "\n"};
}
}
catch (std::exception& e) {
- SLOG(g_log << Logger::Error << RecThreadInfo::thread_local_id() << " Retaining current script, error from '" << fname << "': " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Retaining current script, error in new script"));
+ log->error(Logr::Error, e.what(), "Retaining current script, error in new script");
return new RecursorControlChannel::Answer{1, string("retaining current script, error from '" + fname + "': " + e.what() + "\n")};
}
- SLOG(g_log << Logger::Warning << RecThreadInfo::id() << " (Re)loaded lua script from '" << fname << "'" << endl,
- log->info(Logr::Warning, "(Re)loaded lua script"));
+ log->info(Logr::Warning, "(Re)loaded lua script");
return new RecursorControlChannel::Answer{0, string("(re)loaded '" + fname + "'\n")};
}
}
catch (const std::exception& e) {
auto log = g_slog->withName("runtime");
- SLOG(g_log << Logger::Warning << ", failed: " << e.what() << endl,
- log->error(Logr::Warning, e.what(), "Wipecache failed"));
+ log->error(Logr::Warning, e.what(), "Wipecache failed");
}
return res;
theThread.detach();
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Problem starting RPZIXFRTracker thread: " << e.what() << endl,
- g_slog->withName("rpz")->error(Logr::Error, e.what(), "Exception starting RPZIXFRTracker thread", "exception", Logging::Loggable("std::exception")));
+ g_slog->withName("rpz")->error(Logr::Error, e.what(), "Exception starting RPZIXFRTracker thread", "exception", Logging::Loggable("std::exception"));
exit(1); // NOLINT(concurrency-mt-unsafe)
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Problem starting RPZIXFRTracker thread: " << e.reason << endl,
- g_slog->withName("rpz")->error(Logr::Error, e.reason, "Exception starting RPZIXFRTracker thread", "exception", Logging::Loggable("PDNSException")));
+ g_slog->withName("rpz")->error(Logr::Error, e.reason, "Exception starting RPZIXFRTracker thread", "exception", Logging::Loggable("PDNSException"));
exit(1); // NOLINT(concurrency-mt-unsafe)
}
}
theThread.detach();
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Problem starting ZoneIXFRTracker thread: " << e.what() << endl,
- g_slog->withName("zone")->error(Logr::Error, e.what(), "Exception starting ZoneXFRTracker thread", "exception", Logging::Loggable("std::exception")));
+ g_slog->withName("zone")->error(Logr::Error, e.what(), "Exception starting ZoneXFRTracker thread", "exception", Logging::Loggable("std::exception"));
exit(1); // NOLINT(concurrency-mt-unsafe)
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Problem starting ZoneIXFRTracker thread: " << e.reason << endl,
- g_slog->withName("zone")->error(Logr::Error, e.reason, "Exception starting ZoneXFRTracker thread", "exception", Logging::Loggable("PDNSException")));
+ g_slog->withName("zone")->error(Logr::Error, e.reason, "Exception starting ZoneXFRTracker thread", "exception", Logging::Loggable("PDNSException"));
exit(1); // NOLINT(concurrency-mt-unsafe)
}
}
zone->setName(params.polName.empty() ? "rpzFile" : params.polName);
try {
- SLOG(g_log << Logger::Warning << "Loading RPZ from file '" << params.name << "'" << endl,
- log->info(Logr::Info, "Loading RPZ from file"));
+ log->info(Logr::Info, "Loading RPZ from file");
loadRPZFromFile(params.zoneXFRParams.name, zone, params.defpol, params.defpolOverrideLocal, params.maxTTL);
- SLOG(g_log << Logger::Warning << "Done loading RPZ from file '" << params.name << "'" << endl,
- log->info(Logr::Info, "Done loading RPZ from file"));
+ log->info(Logr::Info, "Done loading RPZ from file");
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Unable to load RPZ zone from '" << params.name << "': " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while loading RPZ zone from file"));
+ log->error(Logr::Error, e.what(), "Exception while loading RPZ zone from file");
zone->clear();
return false;
}
auto log = lci.d_slog->withValues("seedfile", Logging::Loggable(params.seedFileName), "zone", Logging::Loggable(params.zoneXFRParams.name));
if (!params.seedFileName.empty()) {
- SLOG(g_log << Logger::Info << "Pre-loading RPZ zone " << params.name << " from seed file '" << params.seedFileName << "'" << endl,
- log->info(Logr::Info, "Pre-loading RPZ zone from seed file"));
+ log->info(Logr::Info, "Pre-loading RPZ zone from seed file");
try {
params.zoneXFRParams.soaRecordContent = loadRPZFromFile(params.seedFileName, zone, params.defpol, params.defpolOverrideLocal, params.maxTTL);
}
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Warning << "Unable to pre-load RPZ zone " << params.name << " from seed file '" << params.seedFileName << "': " << e.reason << endl,
- log->error(Logr::Warning, e.reason, "Exception while pre-loading RPZ zone", "exception", Logging::Loggable("PDNSException")));
+ log->error(Logr::Warning, e.reason, "Exception while pre-loading RPZ zone", "exception", Logging::Loggable("PDNSException"));
zone->clear();
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Unable to pre-load RPZ zone " << params.name << " from seed file '" << params.seedFileName << "': " << e.what() << endl,
- log->error(Logr::Warning, e.what(), "Exception while pre-loading RPZ zone", "exception", Logging::Loggable("std::exception")));
+ log->error(Logr::Warning, e.what(), "Exception while pre-loading RPZ zone", "exception", Logging::Loggable("std::exception"));
zone->clear();
}
}
}
throw runtime_error("Cannot open " + configname);
}
- SLOG(g_log << Logger::Notice << "Processing YAML settings from " << configname << endl,
- log->info(Logr::Notice, "Processing YAML settings", "path", Logging::Loggable(configname)));
+ log->info(Logr::Notice, "Processing YAML settings", "path", Logging::Loggable(configname));
auto data = string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
pdns::rust::settings::rec::merge(settings, data);
}
msg = stringerror(errno);
return YamlSettingsStatus::CannotOpen;
}
- SLOG(g_log << Logger::Notice << "Processing main YAML settings from " << configname << endl,
- log->info(Logr::Notice, "Processing main YAML settings", "path", Logging::Loggable(configname)));
+ log->info(Logr::Notice, "Processing main YAML settings", "path", Logging::Loggable(configname));
try {
auto data = string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
auto yamlstruct = pdns::rust::settings::rec::parse_yaml_string(data);
void pdns::settings::rec::readYamlAllowFromFile(const std::string& filename, ::rust::Vec<::rust::String>& vec, Logr::log_t log)
{
- SLOG(g_log << Logger::Notice << "Processing allow YAML settings from " << filename << endl,
- log->info(Logr::Notice, "Processing allow YAML settings", "path", Logging::Loggable(filename)));
+ log->info(Logr::Notice, "Processing allow YAML settings", "path", Logging::Loggable(filename));
auto file = ifstream(filename);
if (!file.is_open()) {
throw runtime_error(stringerror(errno));
void pdns::settings::rec::readYamlForwardZonesFile(const std::string& filename, ::rust::Vec<pdns::rust::settings::rec::ForwardZone>& vec, Logr::log_t log)
{
- SLOG(g_log << Logger::Notice << "Processing forwarding YAML settings from " << filename << endl,
- log->info(Logr::Notice, "Processing forwarding YAML settings", "path", Logging::Loggable(filename)));
+ log->info(Logr::Notice, "Processing forwarding YAML settings", "path", Logging::Loggable(filename));
auto file = ifstream(filename);
if (!file.is_open()) {
throw runtime_error(stringerror(errno));
void pdns::settings::rec::readYamlAllowNotifyForFile(const std::string& filename, ::rust::Vec<::rust::String>& vec, Logr::log_t log)
{
- SLOG(g_log << Logger::Notice << "Processing allow-notify-for YAML settings from " << filename << endl,
- log->info(Logr::Notice, "Processing allow-notify-for YAML settings", "path", Logging::Loggable(filename)));
+ log->info(Logr::Notice, "Processing allow-notify-for YAML settings", "path", Logging::Loggable(filename));
auto file = ifstream(filename);
if (!file.is_open()) {
throw runtime_error(stringerror(errno));
switch (yamlstatus) {
case pdns::settings::rec::YamlSettingsStatus::CannotOpen:
- SLOG(g_log << Logger::Debug << "No YAML config found for configname '" << yamlconfigname << "': " << msg << endl,
- startupLog->error(Logr::Debug, msg, "No YAML config found", "configname", Logging::Loggable(yamlconfigname)));
+ startupLog->error(Logr::Debug, msg, "No YAML config found", "configname", Logging::Loggable(yamlconfigname));
break;
case pdns::settings::rec::YamlSettingsStatus::PresentButFailed:
- SLOG(g_log << Logger::Error << "YAML config found for configname '" << yamlconfigname << "' but error ocurred processing it" << endl,
- startupLog->error(Logr::Error, msg, "YAML config found, but error occurred processing it", "configname", Logging::Loggable(yamlconfigname)));
+ startupLog->error(Logr::Error, msg, "YAML config found, but error occurred processing it", "configname", Logging::Loggable(yamlconfigname));
break;
case pdns::settings::rec::YamlSettingsStatus::OK:
yamlSettings = true;
- SLOG(g_log << Logger::Notice << "YAML config found and processed for configname '" << yamlconfigname << "'" << endl,
- startupLog->info(Logr::Notice, "YAML config found and processed", "configname", Logging::Loggable(yamlconfigname)));
+ startupLog->info(Logr::Notice, "YAML config found and processed", "configname", Logging::Loggable(yamlconfigname));
pdns::settings::rec::processAPIDir(arg()["include-dir"], settings, startupLog);
luaSettingsInYAML = pdns::settings::rec::luaItemSet(settings);
if (luaSettingsInYAML && !settings.recursor.lua_config_file.empty()) {
const std::string err = "YAML settings include values originally in Lua but also sets `recursor.lua_config_file`. This is unsupported";
- SLOG(g_log << Logger::Error << err << endl,
- startupLog->info(Logr::Error, err, "configname", Logging::Loggable(yamlconfigname)));
+ startupLog->info(Logr::Error, err, "configname", Logging::Loggable(yamlconfigname));
yamlstatus = pdns::settings::rec::PresentButFailed;
}
else if (!settings.recursor.forwarding_catalog_zones.empty() && settings.webservice.api_dir.empty()) {
static void registerCounter64Stat(const std::string& name, const oid10& statOID)
{
if (statOID.size() != OID_LENGTH(questionsOID)) {
- SLOG(g_log << Logger::Error << "Invalid OID for SNMP Counter64 statistic " << name << endl,
- g_slog->withName("snmp")->info(Logr::Error, "Invalid OID for SNMP Counter64 statistic", "name", Logging::Loggable(name)));
+ g_slog->withName("snmp")->info(Logr::Error, "Invalid OID for SNMP Counter64 statistic", "name", Logging::Loggable(name));
return;
}
if (s_statsMap.find(statOID.at(statOID.size() - 1)) != s_statsMap.end()) {
- SLOG(g_log << Logger::Error << "OID for SNMP Counter64 statistic " << name << " has already been registered" << endl,
- g_slog->withName("snmp")->info(Logr::Error, "OID for SNMP Counter64 statistic has already been registered", "name", Logging::Loggable(name)));
+ g_slog->withName("snmp")->info(Logr::Error, "OID for SNMP Counter64 statistic has already been registered", "name", Logging::Loggable(name));
return;
}
{
try {
if (closesocket(d_fd) < 0) {
- SLOG(g_log << Logger::Error << "Error closing socket for TCPConnection" << endl,
- g_slogtcpin->info(Logr::Error, "Error closing socket for TCPConnection"));
+ g_slogtcpin->info(Logr::Error, "Error closing socket for TCPConnection");
}
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error closing TCPConnection socket: " << e.reason << endl,
- g_slogtcpin->error(Logr::Error, e.reason, "Error closing TCPConnection socket", "exception", Logging::Loggable("PDNSException")));
+ g_slogtcpin->error(Logr::Error, e.reason, "Error closing TCPConnection socket", "exception", Logging::Loggable("PDNSException"));
}
if (t_tcpClientCounts && t_tcpClientCounts->count(d_remote) != 0 && (*t_tcpClientCounts)[d_remote]-- == 0) {
{
if (!t_allowNotifyFrom || !t_allowNotifyFrom->match(comboWriter->d_mappedSource)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping TCP NOTIFY from " << comboWriter->d_mappedSource.toString() << ", address not matched by allow-notify-from" << endl,
- g_slogtcpin->info(Logr::Error, "Dropping TCP NOTIFY, address not matched by allow-notify-from", "source", Logging::Loggable(comboWriter->d_mappedSource)));
+ g_slogtcpin->info(Logr::Error, "Dropping TCP NOTIFY, address not matched by allow-notify-from", "source", Logging::Loggable(comboWriter->d_mappedSource));
}
t_Counters.at(rec::Counter::sourceDisallowedNotify)++;
if (!isAllowNotifyForZone(qname)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping TCP NOTIFY from " << comboWriter->d_mappedSource.toString() << ", for " << qname.toLogString() << ", zone not matched by allow-notify-for" << endl,
- g_slogtcpin->info(Logr::Error, "Dropping TCP NOTIFY, zone not matched by allow-notify-for", "source", Logging::Loggable(comboWriter->d_mappedSource), "zone", Logging::Loggable(qname)));
+ g_slogtcpin->info(Logr::Error, "Dropping TCP NOTIFY, zone not matched by allow-notify-for", "source", Logging::Loggable(comboWriter->d_mappedSource), "zone", Logging::Loggable(qname));
}
t_Counters.at(rec::Counter::zoneDisallowedNotify)++;
}
catch (const std::exception& e) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Warning << "Error parsing a TCP query packet for edns subnet: " << e.what() << endl,
- g_slogtcpin->error(Logr::Warning, e.what(), "Error parsing a TCP query packet for edns subnet", "exception", Logging::Loggable("std::exception"), "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->error(Logr::Warning, e.what(), "Error parsing a TCP query packet for edns subnet", "exception", Logging::Loggable("std::exception"), "remote", Logging::Loggable(conn->d_remote));
}
}
}
bool ipf = t_pdl->ipfilter(comboWriter->d_source, comboWriter->d_destination, *dnsheader, comboWriter->d_eventTrace);
if (ipf) {
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " [" << g_multiTasker->getTid() << "/" << g_multiTasker->numProcesses() << "] DROPPED TCP question from " << comboWriter->d_source.toStringWithPort() << (comboWriter->d_source != comboWriter->d_remote ? " (via " + comboWriter->d_remote.toStringWithPort() + ")" : "") << " based on policy" << endl,
- g_slogtcpin->info(Logr::Info, "Dropped TCP question based on policy", "remote", Logging::Loggable(conn->d_remote), "source", Logging::Loggable(comboWriter->d_source)));
+ g_slogtcpin->info(Logr::Info, "Dropped TCP question based on policy", "remote", Logging::Loggable(conn->d_remote), "source", Logging::Loggable(comboWriter->d_source));
}
t_Counters.at(rec::Counter::policyDrops)++;
return;
if (comboWriter->d_mdp.d_header.qr) {
t_Counters.at(rec::Counter::ignoredCount)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Ignoring answer from TCP client " << comboWriter->getRemote() << " on server socket!" << endl,
- g_slogtcpin->info(Logr::Error, "Ignoring answer from TCP client on server socket", "remote", Logging::Loggable(comboWriter->getRemote())));
+ g_slogtcpin->info(Logr::Error, "Ignoring answer from TCP client on server socket", "remote", Logging::Loggable(comboWriter->getRemote()));
}
return;
}
if (comboWriter->d_mdp.d_header.opcode != static_cast<unsigned>(Opcode::Query) && comboWriter->d_mdp.d_header.opcode != static_cast<unsigned>(Opcode::Notify)) {
t_Counters.at(rec::Counter::ignoredCount)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Ignoring unsupported opcode " << Opcode::to_s(comboWriter->d_mdp.d_header.opcode) << " from TCP client " << comboWriter->getRemote() << " on server socket!" << endl,
- g_slogtcpin->info(Logr::Error, "Ignoring unsupported opcode from TCP client", "remote", Logging::Loggable(comboWriter->getRemote()), "opcode", Logging::Loggable(Opcode::to_s(comboWriter->d_mdp.d_header.opcode))));
+ g_slogtcpin->info(Logr::Error, "Ignoring unsupported opcode from TCP client", "remote", Logging::Loggable(comboWriter->getRemote()), "opcode", Logging::Loggable(Opcode::to_s(comboWriter->d_mdp.d_header.opcode)));
}
sendErrorOverTCP(comboWriter, RCode::NotImp);
tcpGuard.keep();
if (dnsheader->qdcount == 0U) {
t_Counters.at(rec::Counter::emptyQueriesCount)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Ignoring empty (qdcount == 0) query from " << comboWriter->getRemote() << " on server socket!" << endl,
- g_slogtcpin->info(Logr::Error, "Ignoring empty (qdcount == 0) query on server socket", "remote", Logging::Loggable(comboWriter->getRemote())));
+ g_slogtcpin->info(Logr::Error, "Ignoring empty (qdcount == 0) query on server socket", "remote", Logging::Loggable(comboWriter->getRemote()));
}
sendErrorOverTCP(comboWriter, RCode::NotImp);
tcpGuard.keep();
if (cacheHit) {
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " TCP question answered from packet cache tag=" << comboWriter->d_tag << " from " << comboWriter->d_source.toStringWithPort() << (comboWriter->d_source != comboWriter->d_remote ? " (via " + comboWriter->d_remote.toStringWithPort() + ")" : "") << endl,
- g_slogtcpin->info(Logr::Notice, "TCP question answered from packet cache", "tag", Logging::Loggable(comboWriter->d_tag),
- "qname", Logging::Loggable(qname), "qtype", Logging::Loggable(QType(qtype)),
- "source", Logging::Loggable(comboWriter->d_source), "remote", Logging::Loggable(comboWriter->d_remote)));
+ g_slogtcpin->info(Logr::Notice, "TCP question answered from packet cache", "tag", Logging::Loggable(comboWriter->d_tag),
+ "qname", Logging::Loggable(qname), "qtype", Logging::Loggable(QType(qtype)),
+ "source", Logging::Loggable(comboWriter->d_source), "remote", Logging::Loggable(comboWriter->d_remote));
}
bool hadError = sendResponseOverTCP(comboWriter, response);
}
if (comboWriter->d_eventTrace.enabled() && SyncRes::eventTraceEnabled(SyncRes::event_trace_to_log)) {
- SLOG(g_log << Logger::Info << comboWriter->d_eventTrace.toString() << endl,
- g_slogtcpin->info(Logr::Info, comboWriter->d_eventTrace.toString())); // More fancy?
+ g_slogtcpin->info(Logr::Info, comboWriter->d_eventTrace.toString()); // More fancy?
}
tcpGuard.keep();
t_Counters.updateSnap(g_regressionTestMode);
if (comboWriter->d_mdp.d_header.opcode == static_cast<unsigned>(Opcode::Notify)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Notice << RecThreadInfo::id() << " got NOTIFY for " << qname.toLogString() << " from " << comboWriter->d_source.toStringWithPort() << (comboWriter->d_source != comboWriter->d_remote ? " (via " + comboWriter->d_remote.toStringWithPort() + ")" : "") << endl,
- g_slogtcpin->info(Logr::Notice, "Got NOTIFY", "qname", Logging::Loggable(qname), "source", Logging::Loggable(comboWriter->d_source), "remote", Logging::Loggable(comboWriter->d_remote)));
+ g_slogtcpin->info(Logr::Notice, "Got NOTIFY", "qname", Logging::Loggable(qname), "source", Logging::Loggable(comboWriter->d_source), "remote", Logging::Loggable(comboWriter->d_remote));
}
requestWipeCaches(qname);
ssize_t remaining = isProxyHeaderComplete(conn->data);
if (remaining == 0) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unable to consume proxy protocol header in packet from TCP client " << conn->d_remote.toStringWithPort() << endl,
- g_slogtcpin->info(Logr::Error, "Unable to consume proxy protocol header in packet from TCP client", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "Unable to consume proxy protocol header in packet from TCP client", "remote", Logging::Loggable(conn->d_remote));
}
++t_Counters.at(rec::Counter::proxyProtocolInvalidCount);
return;
size_t used = parseProxyHeader(conn->data, proxy, conn->d_source, conn->d_destination, tcp, conn->proxyProtocolValues);
if (used <= 0) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unable to parse proxy protocol header in packet from TCP client " << conn->d_remote.toStringWithPort() << endl,
- g_slogtcpin->info(Logr::Error, "Unable to parse proxy protocol header in packet from TCP client", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "Unable to parse proxy protocol header in packet from TCP client", "remote", Logging::Loggable(conn->d_remote));
}
++t_Counters.at(rec::Counter::proxyProtocolInvalidCount);
return;
}
if (static_cast<size_t>(used) > g_proxyProtocolMaximumSize) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Proxy protocol header in packet from TCP client " << conn->d_remote.toStringWithPort() << " is larger than proxy-protocol-maximum-size (" << used << "), dropping" << endl,
- g_slogtcpin->info(Logr::Error, "Proxy protocol header in packet from TCP client is larger than proxy-protocol-maximum-size", "remote", Logging::Loggable(conn->d_remote), "size", Logging::Loggable(used)));
+ g_slogtcpin->info(Logr::Error, "Proxy protocol header in packet from TCP client is larger than proxy-protocol-maximum-size", "remote", Logging::Loggable(conn->d_remote), "size", Logging::Loggable(used));
}
++t_Counters.at(rec::Counter::proxyProtocolInvalidCount);
return;
}
if (t_allowFrom && !t_allowFrom->match(&conn->d_mappedSource)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping TCP query from " << conn->d_mappedSource.toString() << ", address not matched by allow-from" << endl,
- g_slogtcpin->info(Logr::Error, "Dropping TCP query, address not matched by allow-from", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "Dropping TCP query, address not matched by allow-from", "remote", Logging::Loggable(conn->d_remote));
}
++t_Counters.at(rec::Counter::unauthorizedTCP);
if (bytes <= 0) {
if (!tcpGuard.handleTCPReadResult(fileDesc, bytes)) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "TCP client " << conn->d_remote.toStringWithPort() << " disconnected after first byte" << endl,
- g_slogtcpin->info(Logr::Error, "TCP client disconnected after first byte", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "TCP client disconnected after first byte", "remote", Logging::Loggable(conn->d_remote));
}
}
return;
if (bytes <= 0) {
if (!tcpGuard.handleTCPReadResult(fileDesc, bytes)) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "TCP client " << conn->d_remote.toStringWithPort() << " disconnected while reading question body" << endl,
- g_slogtcpin->info(Logr::Error, "TCP client disconnected while reading question body", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "TCP client disconnected while reading question body", "remote", Logging::Loggable(conn->d_remote));
}
}
return;
}
if (bytes > std::numeric_limits<std::uint16_t>::max()) {
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "TCP client " << conn->d_remote.toStringWithPort() << " sent an invalid question size while reading question body" << endl,
- g_slogtcpin->info(Logr::Error, "TCP client sent an invalid question size while reading question body", "remote", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "TCP client sent an invalid question size while reading question body", "remote", Logging::Loggable(conn->d_remote));
}
return;
}
catch (const MOADNSException& mde) {
t_Counters.at(rec::Counter::clientParseError)++;
if (g_logCommonErrors) {
- SLOG(g_log << Logger::Error << "Unable to parse packet from TCP client " << conn->d_remote.toStringWithPort() << endl,
- g_slogtcpin->info(Logr::Error, "Unable to parse packet from TCP client", "remte", Logging::Loggable(conn->d_remote)));
+ g_slogtcpin->info(Logr::Error, "Unable to parse packet from TCP client", "remte", Logging::Loggable(conn->d_remote));
}
return;
}
}
if (!fromProxyProtocolSource && t_allowFrom && !t_allowFrom->match(&mappedSource)) {
if (!g_quiet) {
- SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping TCP query from " << mappedSource.toString() << ", address neither matched by allow-from nor proxy-protocol-from" << endl,
- g_slogtcpin->info(Logr::Error, "dropping TCP query address neither matched by allow-from nor proxy-protocol-from", "source", Logging::Loggable(mappedSource)));
+ g_slogtcpin->info(Logr::Error, "dropping TCP query address neither matched by allow-from nor proxy-protocol-from", "source", Logging::Loggable(mappedSource));
}
closeSock(rec::Counter::unauthorizedTCP, "Error closing TCP socket after an ACL drop");
return;
if (readFileIfThere("/proc/sys/net/ipv4/tcp_fastopen", &line)) {
int flag = std::stoi(line);
if (active && !(flag & 1)) {
- SLOG(g_log << Logger::Error << "tcp-fast-open-connect enabled but net.ipv4.tcp_fastopen does not allow it" << endl,
- log->info(Logr::Error, "tcp-fast-open-connect enabled but net.ipv4.tcp_fastopen does not allow it"));
+ log->info(Logr::Error, "tcp-fast-open-connect enabled but net.ipv4.tcp_fastopen does not allow it");
}
if (!active && !(flag & 2)) {
- SLOG(g_log << Logger::Error << "tcp-fast-open enabled but net.ipv4.tcp_fastopen does not allow it" << endl,
- log->info(Logr::Error, "tcp-fast-open enabled but net.ipv4.tcp_fastopen does not allow it"));
+ log->info(Logr::Error, "tcp-fast-open enabled but net.ipv4.tcp_fastopen does not allow it");
}
}
else {
- SLOG(g_log << Logger::Notice << "Cannot determine if kernel settings allow fast-open" << endl,
- log->info(Logr::Notice, "Cannot determine if kernel settings allow fast-open"));
+ log->info(Logr::Notice, "Cannot determine if kernel settings allow fast-open");
}
#else
- SLOG(g_log << Logger::Notice << "Cannot determine if kernel settings allow fast-open" << endl,
- log->info(Logr::Notice, "Cannot determine if kernel settings allow fast-open"));
+ log->info(Logr::Notice, "Cannot determine if kernel settings allow fast-open");
#endif
}
socket.setFastOpenConnect();
}
catch (const NetworkError& e) {
- SLOG(g_log << Logger::Error << "tcp-fast-open-connect enabled but returned error: " << e.what() << endl,
- log->error(Logr::Error, e.what(), "tcp-fast-open-connect enabled but returned error"));
+ log->error(Logr::Error, e.what(), "tcp-fast-open-connect enabled but returned error");
}
}
int tmp = 1;
if (setsockopt(socketFd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof tmp) < 0) {
int err = errno;
- SLOG(g_log << Logger::Error << "Setsockopt failed for TCP listening socket" << endl,
- log->error(Logr::Critical, err, "Setsockopt failed for TCP listening socket"));
+ log->error(Logr::Critical, err, "Setsockopt failed for TCP listening socket");
_exit(1);
}
if (address.sin6.sin6_family == AF_INET6 && setsockopt(socketFd, IPPROTO_IPV6, IPV6_V6ONLY, &tmp, sizeof(tmp)) < 0) {
int err = errno;
- SLOG(g_log << Logger::Error << "Failed to set IPv6 socket to IPv6 only, continuing anyhow: " << stringerror(err) << endl,
- log->error(Logr::Warning, err, "Failed to set IPv6 socket to IPv6 only, continuing anyhow"));
+ log->error(Logr::Warning, err, "Failed to set IPv6 socket to IPv6 only, continuing anyhow");
}
#ifdef TCP_DEFER_ACCEPT
if (setsockopt(socketFd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &tmp, sizeof tmp) >= 0) {
if (first) {
- SLOG(g_log << Logger::Info << "Enabled TCP data-ready filter for (slight) DoS protection" << endl,
- log->info(Logr::Info, "Enabled TCP data-ready filter for (slight) DoS protection"));
+ log->info(Logr::Info, "Enabled TCP data-ready filter for (slight) DoS protection");
}
}
#endif
#ifdef TCP_FASTOPEN
if (setsockopt(socketFd, IPPROTO_TCP, TCP_FASTOPEN, &SyncRes::s_tcp_fast_open, sizeof SyncRes::s_tcp_fast_open) < 0) {
int err = errno;
- SLOG(g_log << Logger::Error << "Failed to enable TCP Fast Open for listening socket: " << stringerror(err) << endl,
- log->error(Logr::Error, err, "Failed to enable TCP Fast Open for listening socket"));
+ log->error(Logr::Error, err, "Failed to enable TCP Fast Open for listening socket");
}
#else
- SLOG(g_log << Logger::Warning << "TCP Fast Open configured but not supported for listening socket" << endl,
- log->info(Logr::Warning, "TCP Fast Open configured but not supported for listening socket"));
+ log->info(Logr::Warning, "TCP Fast Open configured but not supported for listening socket");
#endif
}
setSocketSendBuffer(socketFd, 65000);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << e.what() << endl,
- log->error(Logr::Error, e.what(), "Exception while setting socket send buffer"));
+ log->error(Logr::Error, e.what(), "Exception while setting socket send buffer");
}
listen(socketFd, 128);
g_proxyMapping = proxyMapping.empty() ? nullptr : std::make_unique<ProxyMapping>(proxyMapping);
}
if (broadcast) {
- SLOG(g_log << Logger::Notice << "Reloaded Lua configuration file '" << ::arg()["lua-config-file"] << "', requested via control channel" << endl,
- g_slog->withName("config")->info(Logr::Info, "Reloaded"));
+ g_slog->withName("config")->info(Logr::Info, "Reloaded");
}
return {0, "Reloaded Lua configuration file '" + ::arg()["lua-config-file"] + "'\n"};
}
auto log = g_slog->withName("config");
if (SyncRes::s_doIPv4 && !SyncRes::s_doIPv6 && !reachableA) {
- SLOG(g_log << Logger::Error << "Running IPv4 only but no IPv4 root hints" << endl,
- log->info(Logr::Error, "Running IPv4 only but no IPv4 root hints"));
+ log->info(Logr::Error, "Running IPv4 only but no IPv4 root hints");
return false;
}
if (!SyncRes::s_doIPv4 && SyncRes::s_doIPv6 && !reachableAAAA) {
- SLOG(g_log << Logger::Error << "Running IPv6 only but no IPv6 root hints" << endl,
- log->info(Logr::Error, "Running IPv6 only but no IPv6 root hints"));
+ log->info(Logr::Error, "Running IPv6 only but no IPv6 root hints");
return false;
}
if (SyncRes::s_doIPv4 && SyncRes::s_doIPv6 && !reachableA && !reachableAAAA) {
- SLOG(g_log << Logger::Error << "No valid root hints" << endl,
- log->info(Logr::Error, "No valid root hints"));
+ log->info(Logr::Error, "No valid root hints");
return false;
}
return true;
const bool reverse = false)
{
if (newMap.count(name) != 0) {
- SLOG(g_log << Logger::Warning << "Will not overwrite zone '" << name << "' already loaded" << endl,
- log->info(Logr::Warning, "Will not overwrite already loaded zone", "zone",
- Logging::Loggable(name)));
+ log->info(Logr::Warning, "Will not overwrite already loaded zone", "zone",
+ Logging::Loggable(name));
}
else {
if (!partial) {
const auto direction = reverse ? std::string{"reverse"} : std::string{"forward"};
- SLOG(g_log << Logger::Warning << "Inserting " << direction << " zone '" << name << "' based on hosts file" << endl,
- log->info(Logr::Notice, "Inserting " + direction + " zone based on hosts file", "zone", Logging::Loggable(name)));
+ log->info(Logr::Notice, "Inserting " + direction + " zone based on hosts file", "zone", Logging::Loggable(name));
}
ad.d_name = name;
newMap[ad.d_name] = ad;
if (hintfile == "no" || hintfile == "no-refresh") {
auto log = g_slog->withName("config");
- SLOG(g_log << Logger::Debug << "Priming root disabled by hint-file setting" << endl,
- log->info(Logr::Debug, "Priming root disabled by hint-file setting"));
+ log->info(Logr::Debug, "Priming root disabled by hint-file setting");
return ret;
}
cleanSlashes(configname);
try {
- SLOG(g_log << Logger::Warning << "Reloading zones, purging data from cache" << endl,
- log->info(Logr::Notice, "Reloading zones, purging data from cache"));
+ log->info(Logr::Notice, "Reloading zones, purging data from cache");
if (yaml) {
configname += g_yamlSettingsSuffix;
return "ok\n";
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Encountered error reloading zones, keeping original data: " << e.what() << endl,
- log->error(Logr::Error, e.what(), "Encountered error reloading zones, keeping original data"));
+ log->error(Logr::Error, e.what(), "Encountered error reloading zones, keeping original data");
}
catch (const PDNSException& ae) {
- SLOG(g_log << Logger::Error << "Encountered error reloading zones, keeping original data: " << ae.reason << endl,
- log->error(Logr::Error, ae.reason, "Encountered error reloading zones, keeping original data"));
+ log->error(Logr::Error, ae.reason, "Encountered error reloading zones, keeping original data");
}
catch (...) {
- SLOG(g_log << Logger::Error << "Encountered unknown error reloading zones, keeping original data" << endl,
- log->error(Logr::Error, "Exception", "Encountered error reloading zones, keeping original data"));
+ log->error(Logr::Error, "Exception", "Encountered error reloading zones, keeping original data");
}
return "reloading failed, see log\n";
}
static void readAuthZoneData(SyncRes::AuthDomain& authDomain, const pair<string, string>& headers, Logr::log_t log)
{
- SLOG(g_log << Logger::Notice << "Parsing authoritative data for zone '" << headers.first << "' from file '" << headers.second << "'" << endl,
- log->info(Logr::Notice, "Parsing authoritative data from file", "zone", Logging::Loggable(headers.first), "file", Logging::Loggable(headers.second)));
+ log->info(Logr::Notice, "Parsing authoritative data from file", "zone", Logging::Loggable(headers.first), "file", Logging::Loggable(headers.second));
ZoneParserTNG zpt(headers.second, DNSName(headers.first));
zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
zpt.setMaxIncludes(::arg().asNum("max-include-depth"));
return;
}
- SLOG(g_log << Logger::Notice << "Processing ApiZones YAML settings from " << filename << endl,
- log->info(Logr::Notice, "Processing ApiZones YAML settings", "path", Logging::Loggable(filename)));
+ log->info(Logr::Notice, "Processing ApiZones YAML settings", "path", Logging::Loggable(filename));
const uint64_t before = newMap->size();
readAuthZoneData(authDomain, {string(auth.zone), string(auth.file)}, log);
(*newMap)[authDomain.d_name] = authDomain;
}
- SLOG(g_log << Logger::Warning << "Done parsing " << newMap->size() - before
- << " ApiZones YAML settings from file '"
- << filename << "'" << endl,
- log->info(Logr::Notice, "Done parsing ApiZones YAML from file", "file",
- Logging::Loggable(filename), "count",
- Logging::Loggable(newMap->size() - before)));
+ log->info(Logr::Notice, "Done parsing ApiZones YAML from file", "file",
+ Logging::Loggable(filename), "count",
+ Logging::Loggable(newMap->size() - before));
}
static void processForwardZonesFile(shared_ptr<SyncRes::domainmap_t>& newMap, shared_ptr<notifyset_t>& newSet, Logr::log_t log)
}
}
else {
- SLOG(g_log << Logger::Warning << "Reading zone forwarding information from '" << filename << "'" << endl,
- log->info(Logr::Notice, "Reading zone forwarding information", "file", Logging::Loggable(filename)));
+ log->info(Logr::Notice, "Reading zone forwarding information", "file", Logging::Loggable(filename));
auto filePtr = pdns::UniqueFilePtr(fopen(filename.c_str(), "r"));
if (!filePtr) {
int err = errno;
}
}
}
- SLOG(g_log << Logger::Warning << "Done parsing " << newMap->size() - before
- << " forwarding instructions from file '"
- << filename << "'" << endl,
- log->info(Logr::Notice, "Done parsing forwarding instructions from file", "file",
- Logging::Loggable(filename), "count",
- Logging::Loggable(newMap->size() - before)));
+ log->info(Logr::Notice, "Done parsing forwarding instructions from file", "file",
+ Logging::Loggable(filename), "count",
+ Logging::Loggable(newMap->size() - before));
}
static void processExportEtcHosts(std::shared_ptr<SyncRes::domainmap_t>& newMap, Logr::log_t log)
string fname = ::arg()["etc-hosts-file"];
ifstream ifs(fname);
if (!ifs) {
- SLOG(g_log << Logger::Warning << "Could not open " << fname << " for reading" << endl,
- log->error(Logr::Warning, "Could not open file for reading", "file", Logging::Loggable(fname)));
+ log->error(Logr::Warning, "Could not open file for reading", "file", Logging::Loggable(fname));
return;
}
vector<string> parts;
addForwardAndReverseLookupEntries(*newMap, searchSuffix, parts, log);
}
catch (const PDNSException& ex) {
- SLOG(g_log << Logger::Warning
- << "The line `" << line << "` "
- << "in the provided etc-hosts file `" << fname << "` "
- << "could not be added: " << ex.reason << ". Going to skip it."
- << endl,
- log->info(Logr::Notice, "Skipping line in etc-hosts file",
- "line", Logging::Loggable(line),
- "hosts-file", Logging::Loggable(fname),
- "reason", Logging::Loggable(ex.reason)));
+ log->info(Logr::Notice, "Skipping line in etc-hosts file",
+ "line", Logging::Loggable(line),
+ "hosts-file", Logging::Loggable(fname),
+ "reason", Logging::Loggable(ex.reason));
}
}
}
if (!::arg().mustDo("serve-rfc1918")) {
return;
}
- SLOG(g_log << Logger::Warning << "Inserting rfc 1918 private space zones" << endl,
- log->info(Logr::Notice, "Inserting rfc 1918 private space zones"));
+ log->info(Logr::Notice, "Inserting rfc 1918 private space zones");
makePartialIPZone(*newMap, {"127"}, log);
makePartialIPZone(*newMap, {"10"}, log);
if (!::arg().mustDo("serve-rfc1918")) {
return;
}
- SLOG(g_log << Logger::Warning << "Inserting rfc 6303 private space zones" << endl,
- log->info(Logr::Notice, "Inserting rfc 6303 private space zones"));
+ log->info(Logr::Notice, "Inserting rfc 6303 private space zones");
// Section 4.2
makePartialIPZone(*newMap, {"0"}, log);
// makePartialIPZone(*newMap, { "127" }, log) already done in processServeRFC1918
}
}
else {
- SLOG(g_log << Logger::Warning << "Reading NOTIFY-allowed zones from '" << filename << "'" << endl,
- log->info(Logr::Notice, "Reading NOTIFY-allowed zones from file", "file", Logging::Loggable(filename)));
+ log->info(Logr::Notice, "Reading NOTIFY-allowed zones from file", "file", Logging::Loggable(filename));
auto filePtr = pdns::UniqueFilePtr(fopen(filename.c_str(), "r"));
if (!filePtr) {
throw PDNSException("Error opening allow-notify-for-file '" + filename + "': " + stringerror());
newSet->insert(DNSName(line));
}
}
- SLOG(g_log << Logger::Warning << "Done parsing " << newSet->size() - before << " NOTIFY-allowed zones from file '" << filename << "'" << endl,
- log->info(Logr::Notice, "Done parsing NOTIFY-allowed zones from file", "file", Logging::Loggable(filename), "count", Logging::Loggable(newSet->size() - before)));
+ log->info(Logr::Notice, "Done parsing NOTIFY-allowed zones from file", "file", Logging::Loggable(filename), "count", Logging::Loggable(newSet->size() - before));
}
std::tuple<std::shared_ptr<SyncRes::domainmap_t>, std::shared_ptr<notifyset_t>> parseZoneConfiguration(bool yaml)
else if (!crcTarget.empty() && !crcTarget.isRoot() && crcTarget.getRawLabel(crcTarget.countLabels() - 1).compare(0, rpzPrefix.length(), rpzPrefix) == 0) {
/* this is very likely an higher format number or a configuration error,
let's just ignore it. */
- SLOG(g_log << Logger::Info << "Discarding unsupported RPZ entry " << crcTarget << " for " << dnsRecord.d_name << endl,
- log->info(Logr::Info, "Discarding unsupported RPZ entry", "target", Logging::Loggable(crcTarget), "name", Logging::Loggable(dnsRecord.d_name)));
+ log->info(Logr::Info, "Discarding unsupported RPZ entry", "target", Logging::Loggable(crcTarget), "name", Logging::Loggable(dnsRecord.d_name));
return;
}
else {
{
auto logger = plogger->withValues("primary", Logging::Loggable(primary));
- SLOG(g_log << Logger::Warning << "Loading RPZ zone '" << zoneName << "' from " << primary.toStringWithPort() << endl,
- logger->info(Logr::Info, "Loading RPZ from nameserver"));
+ logger->info(Logr::Info, "Loading RPZ from nameserver");
if (!tsigTriplet.name.empty()) {
- SLOG(g_log << Logger::Warning << "With TSIG key '" << tsigTriplet.name << "' of algorithm '" << tsigTriplet.algo << "'" << endl,
- logger->info(Logr::Info, "Using TSIG key for authentication", "tsig_key_name", Logging::Loggable(tsigTriplet.name), "tsig_key_algorithm", Logging::Loggable(tsigTriplet.algo)));
+ logger->info(Logr::Info, "Using TSIG key for authentication", "tsig_key_name", Logging::Loggable(tsigTriplet.name), "tsig_key_algorithm", Logging::Loggable(tsigTriplet.algo));
}
ComboAddress local(localAddress);
throw PDNSException("Total AXFR time exceeded!");
}
if (last != time(nullptr)) {
- SLOG(g_log << Logger::Info << "Loaded & indexed " << nrecords << " policy records so far for RPZ zone '" << zoneName << "'" << endl,
- logger->info(Logr::Info, "RPZ load in progress", "nrecords", Logging::Loggable(nrecords)));
+ logger->info(Logr::Info, "RPZ load in progress", "nrecords", Logging::Loggable(nrecords));
last = time(nullptr);
}
}
- SLOG(g_log << Logger::Info << "Done: " << nrecords << " policy records active, SOA: " << soaRecordContent->getZoneRepresentation() << endl,
- logger->info(Logr::Info, "RPZ load completed", "nrecords", Logging::Loggable(nrecords), "soa", Logging::Loggable(soaRecordContent->getZoneRepresentation())));
+ logger->info(Logr::Info, "RPZ load completed", "nrecords", Logging::Loggable(nrecords), "soa", Logging::Loggable(soaRecordContent->getZoneRepresentation()));
return soaRecordContent;
}
auto tempFile = UniqueFilenameDeleterPtr(new string(dumpZoneFileName + "XXXXXX"));
int fileDesc = mkstemp(tempFile->data());
if (fileDesc < 0) {
- SLOG(g_log << Logger::Warning << "Unable to open a file to dump the content of the RPZ zone " << zoneName << endl,
- logger->error(Logr::Error, errno, "Unable to create temporary file"));
+ logger->error(Logr::Error, errno, "Unable to create temporary file");
tempFile->clear(); // file has not been created, no need to unlink
return false;
}
if (!filePtr) {
int err = errno;
close(fileDesc);
- SLOG(g_log << Logger::Warning << "Unable to open a file pointer to dump the content of the RPZ zone " << zoneName << endl,
- logger->error(Logr::Error, err, "Unable to open file pointer"));
+ logger->error(Logr::Error, err, "Unable to open file pointer");
return false;
}
newZone->dump(filePtr.get());
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Error while dumping the content of the RPZ zone " << zoneName << ": " << e.what() << endl,
- logger->error(Logr::Error, e.what(), "Error while dumping the content of the RPZ"));
+ logger->error(Logr::Error, e.what(), "Error while dumping the content of the RPZ");
return false;
}
if (fflush(filePtr.get()) != 0) {
- SLOG(g_log << Logger::Warning << "Error while flushing the content of the RPZ zone " << zoneName << " to the dump file: " << stringerror() << endl,
- logger->error(Logr::Warning, errno, "Error while flushing the content of the RPZ"));
+ logger->error(Logr::Warning, errno, "Error while flushing the content of the RPZ");
return false;
}
if (fsync(fileno(filePtr.get())) != 0) {
- SLOG(g_log << Logger::Warning << "Error while syncing the content of the RPZ zone " << zoneName << " to the dump file: " << stringerror() << endl,
- logger->error(Logr::Error, errno, "Error while syncing the content of the RPZ"));
+ logger->error(Logr::Error, errno, "Error while syncing the content of the RPZ");
return false;
}
if (fclose(filePtr.release()) != 0) {
- SLOG(g_log << Logger::Warning << "Error while writing the content of the RPZ zone " << zoneName << " to the dump file: " << stringerror() << endl,
- logger->error(Logr::Error, errno, "Error while writing the content of the RPZ"));
+ logger->error(Logr::Error, errno, "Error while writing the content of the RPZ");
return false;
}
if (rename(tempFile->c_str(), dumpZoneFileName.c_str()) != 0) {
- SLOG(g_log << Logger::Warning << "Error while moving the content of the RPZ zone " << zoneName << " to the dump file: " << stringerror() << endl,
- logger->error(Logr::Error, errno, "Error while moving the content of the RPZ", "destination_file", Logging::Loggable(dumpZoneFileName)));
+ logger->error(Logr::Error, errno, "Error while moving the content of the RPZ", "destination_file", Logging::Loggable(dumpZoneFileName));
return false;
}
tempFile->clear(); // file has been renamed, no need to unlink
break;
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Unable to load RPZ zone '" << zoneName << "' from '" << primary << "': '" << e.what() << "'. (Will try again in " << refresh << " seconds...)" << endl,
- logger->error(Logr::Warning, e.what(), "Unable to load RPZ zone, will retry", "from", Logging::Loggable(primary), "exception", Logging::Loggable("std::exception"), "refresh", Logging::Loggable(refresh)));
+ logger->error(Logr::Warning, e.what(), "Unable to load RPZ zone, will retry", "from", Logging::Loggable(primary), "exception", Logging::Loggable("std::exception"), "refresh", Logging::Loggable(refresh));
incRPZFailedTransfers(polName);
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Warning << "Unable to load RPZ zone '" << zoneName << "' from '" << primary << "': '" << e.reason << "'. (Will try again in " << refresh << " seconds...)" << endl,
- logger->error(Logr::Warning, e.reason, "Unable to load RPZ zone, will retry", "from", Logging::Loggable(primary), "exception", Logging::Loggable("PDNSException"), "refresh", Logging::Loggable(refresh)));
+ logger->error(Logr::Warning, e.reason, "Unable to load RPZ zone, will retry", "from", Logging::Loggable(primary), "exception", Logging::Loggable("PDNSException"), "refresh", Logging::Loggable(refresh));
incRPZFailedTransfers(polName);
}
}
/* the configuration has been reloaded, meaning that a new thread
has been started to handle that zone and we are now obsolete.
*/
- SLOG(g_log << Logger::Info << "A more recent configuration has been found, stopping the existing RPZ update thread for " << zoneName << endl,
- logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread"));
+ logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread");
return false;
}
auto primary = pdns::fromNameOrIP(ipOrName, 53, logger);
auto soa = getRR<SOARecordContent>(dnsRecord);
auto serial = soa ? soa->d_st.serial : 0;
- SLOG(g_log << Logger::Info << "Getting IXFR deltas for " << zoneName << " from " << primary.toStringWithPort() << ", our serial: " << serial << endl,
- logger->info(Logr::Info, "Getting IXFR deltas", "address", Logging::Loggable(primary), "ourserial", Logging::Loggable(serial)));
+ logger->info(Logr::Info, "Getting IXFR deltas", "address", Logging::Loggable(primary), "ourserial", Logging::Loggable(serial));
ComboAddress local(params.zoneXFRParams.localAddress);
if (local == ComboAddress()) {
break;
}
catch (const std::runtime_error& e) {
- SLOG(g_log << Logger::Warning << e.what() << endl,
- logger->error(Logr::Warning, e.what(), "Exception during retrieval of delta", "exception", Logging::Loggable("std::runtime_error")));
+ logger->error(Logr::Warning, e.what(), "Exception during retrieval of delta", "exception", Logging::Loggable("std::runtime_error"));
incRPZFailedTransfers(polName);
continue;
}
}
try {
- SLOG(g_log << Logger::Info << "Processing " << deltas.size() << " delta" << addS(deltas) << " for RPZ " << zoneName << endl,
- logger->info(Logr::Info, "Processing deltas", "size", Logging::Loggable(deltas.size())));
+ logger->info(Logr::Info, "Processing deltas", "size", Logging::Loggable(deltas.size()));
if (luaconfsLocal->generation != configGeneration) {
- SLOG(g_log << Logger::Info << "A more recent configuration has been found, stopping the existing RPZ update thread for " << zoneName << endl,
- logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread"));
+ logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread");
return false;
}
oldZone = luaconfsLocal->dfe.getZone(params.zoneXFRParams.zoneIdx);
if (!oldZone || oldZone->getDomain() != zoneName) {
- SLOG(g_log << Logger::Info << "This policy is no more, stopping the existing RPZ update thread for " << zoneName << endl,
- logger->info(Logr::Info, "This policy is no more, stopping the existing RPZ update thread"));
+ logger->info(Logr::Info, "This policy is no more, stopping the existing RPZ update thread");
return false;
}
/* we need to make a _full copy_ of the zone we are going to work on */
const auto& remove = delta.first;
const auto& add = delta.second;
if (remove.empty()) {
- SLOG(g_log << Logger::Warning << "IXFR update is a whole new zone" << endl,
- logger->info(Logr::Warning, "IXFR update is a whole new zone"));
+ logger->info(Logr::Warning, "IXFR update is a whole new zone");
newZone->clear();
fullUpdate = true;
}
}
else {
totremove++;
- SLOG(g_log << (g_logRPZChanges ? Logger::Info : Logger::Debug) << "Had removal of " << resourceRecord.d_name << " from RPZ zone " << zoneName << endl,
- logger->info(g_logRPZChanges ? Logr::Info : Logr::Debug, "Remove from RPZ zone", "name", Logging::Loggable(resourceRecord.d_name)));
+ logger->info(g_logRPZChanges ? Logr::Info : Logr::Debug, "Remove from RPZ zone", "name", Logging::Loggable(resourceRecord.d_name));
RPZRecordToPolicy(resourceRecord, newZone, false, params.defpol, params.defpolOverrideLocal, params.maxTTL, logger);
}
}
}
else {
totadd++;
- SLOG(g_log << (g_logRPZChanges ? Logger::Info : Logger::Debug) << "Had addition of " << resourceRecord.d_name << " to RPZ zone " << zoneName << endl,
- logger->info(g_logRPZChanges ? Logr::Info : Logr::Debug, "Addition to RPZ zone", "name", Logging::Loggable(resourceRecord.d_name)));
+ logger->info(g_logRPZChanges ? Logr::Info : Logr::Debug, "Addition to RPZ zone", "name", Logging::Loggable(resourceRecord.d_name));
RPZRecordToPolicy(resourceRecord, newZone, true, params.defpol, params.defpolOverrideLocal, params.maxTTL, logger);
}
}
newZone->setSOA(std::move(dnsRecord));
params.zoneXFRParams.soaRecordContent = std::move(currentSR);
}
- SLOG(g_log << Logger::Info << "Had " << totremove << " RPZ removal" << addS(totremove) << ", " << totadd << " addition" << addS(totadd) << " for " << zoneName << " New serial: " << params.soaRecordContent->d_st.serial << endl,
- logger->info(Logr::Info, "RPZ mutations", "removals", Logging::Loggable(totremove), "additions", Logging::Loggable(totadd), "newserial", Logging::Loggable(params.zoneXFRParams.soaRecordContent->d_st.serial)));
+ logger->info(Logr::Info, "RPZ mutations", "removals", Logging::Loggable(totremove), "additions", Logging::Loggable(totadd), "newserial", Logging::Loggable(params.zoneXFRParams.soaRecordContent->d_st.serial));
newZone->setSerial(params.zoneXFRParams.soaRecordContent->d_st.serial);
newZone->setRefresh(params.zoneXFRParams.soaRecordContent->d_st.refresh);
setRPZZoneNewState(polName, params.zoneXFRParams.soaRecordContent->d_st.serial, newZone->size(), false, fullUpdate);
since they might have been updated by another RPZ IXFR tracker thread.
*/
if (luaconfsLocal->generation != configGeneration) {
- SLOG(g_log << Logger::Info << "A more recent configuration has been found, stopping the existing RPZ update thread for " << zoneName << endl,
- logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread"));
+ logger->info(Logr::Info, "A more recent configuration has been found, stopping the existing RPZ update thread");
return false;
}
g_luaconfs.modify([zoneIdx = params.zoneXFRParams.zoneIdx, &newZone](LuaConfigItems& lci) {
refresh = std::max(params.zoneXFRParams.refreshFromConf != 0 ? params.zoneXFRParams.refreshFromConf : newZone->getRefresh(), 1U);
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Error while applying the update received over XFR for " << zoneName << ", skipping the update: " << e.what() << endl,
- logger->error(Logr::Error, e.what(), "Exception while applying the update received over XFR, skipping", "exception", Logging::Loggable("std::exception")));
+ logger->error(Logr::Error, e.what(), "Exception while applying the update received over XFR, skipping", "exception", Logging::Loggable("std::exception"));
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Error while applying the update received over XFR for " << zoneName << ", skipping the update: " << e.reason << endl,
- logger->error(Logr::Error, e.reason, "Exception while applying the update received over XFR, skipping", "exception", Logging::Loggable("PDNSException")));
+ logger->error(Logr::Error, e.reason, "Exception while applying the update received over XFR, skipping", "exception", Logging::Loggable("PDNSException"));
}
return true;
}
/* 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) {
- SLOG(g_log << Logger::Error << "Unable to retrieve RPZ zone with index " << params.zoneIdx << " from the configuration, exiting" << endl,
- logger->error(Logr::Error, "Unable to retrieve RPZ zone from configuration", "index", Logging::Loggable(params.zoneXFRParams.zoneIdx)));
+ logger->error(Logr::Error, "Unable to retrieve RPZ zone from configuration", "index", Logging::Loggable(params.zoneXFRParams.zoneIdx));
return;
}
auto vlog = log->withValues("version", Logging::Loggable(pkgv), "query", Logging::Loggable(query));
if (vStateIsBogus(state)) {
- SLOG(g_log << Logger::Error << "Failed to retrieve security status update for '" + pkgv + "' on '" << query << "', DNSSEC validation result was Bogus!" << endl,
- vlog->info(Logr::Error, "Failed to retrieve security status update", "validationResult", Logging::Loggable(vStateToString(state))));
+ vlog->info(Logr::Error, "Failed to retrieve security status update", "validationResult", Logging::Loggable(vStateToString(state)));
if (g_security_status == 1) { // If we were OK, go to unknown
g_security_status = 0;
}
}
if (res == RCode::NXDomain && !isReleaseVersion(pkgv)) {
- SLOG(g_log << Logger::Warning << "Not validating response for security status update, this is a non-release version" << endl,
- vlog->info(Logr::Warning, "Not validating response for security status update, this is a non-release version"));
+ vlog->info(Logr::Warning, "Not validating response for security status update, this is a non-release version");
return;
}
}
catch (const PDNSException& pe) {
g_security_status = security_status;
- SLOG(g_log << Logger::Warning << "Failed to retrieve security status update for '" << pkgv << "' on '" << query << "': " << pe.reason << endl,
- vlog->error(Logr::Warning, pe.reason, "Failed to retrieve security status update"));
+ vlog->error(Logr::Warning, pe.reason, "Failed to retrieve security status update");
return;
}
auto rlog = vlog->withValues("securitymessage", Logging::Loggable(security_message), "status", Logging::Loggable(security_status));
if (g_security_status != 1 && security_status == 1) {
- SLOG(g_log << Logger::Warning << "Polled security status of version " << pkgv << ", no known issues reported: " << security_message << endl,
- rlog->info(Logr::Notice, "Polled security status of version, no known issues reported"));
+ rlog->info(Logr::Notice, "Polled security status of version, no known issues reported");
}
if (security_status == 2) {
- SLOG(g_log << Logger::Error << "PowerDNS Security Update Recommended: " << security_message << endl,
- rlog->info(Logr::Error, "PowerDNS Security Update Recommended"));
+ rlog->info(Logr::Error, "PowerDNS Security Update Recommended");
}
if (security_status == 3) {
- SLOG(g_log << Logger::Error << "PowerDNS Security Update Mandatory: " << security_message << endl,
- rlog->info(Logr::Error, "PowerDNS Security Update Mandatory"));
+ rlog->info(Logr::Error, "PowerDNS Security Update Mandatory");
}
g_security_status = security_status;
res = resolver.beginResolve(qname, qtype, qclass, ret, 0);
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Warning << "Failed to resolve " << qname << ", got pdns exception: " << e.reason << endl,
- log->error(Logr::Warning, e.reason, msg, "exception", Logging::Loggable("PDNSException")));
+ log->error(Logr::Warning, e.reason, msg, "exception", Logging::Loggable("PDNSException"));
ret.clear();
}
catch (const ImmediateServFailException& e) {
- SLOG(g_log << Logger::Warning << "Failed to resolve " << qname << ", got ImmediateServFailException: " << e.reason << endl,
- log->error(Logr::Warning, e.reason, msg, "exception", Logging::Loggable("ImmediateServFailException")));
+ log->error(Logr::Warning, e.reason, msg, "exception", Logging::Loggable("ImmediateServFailException"));
ret.clear();
}
catch (const PolicyHitException& e) {
- SLOG(g_log << Logger::Warning << "Failed to resolve " << qname << ", got a policy hit" << endl,
- log->info(Logr::Warning, msg, "exception", Logging::Loggable("PolicyHitException")));
+ log->info(Logr::Warning, msg, "exception", Logging::Loggable("PolicyHitException"));
ret.clear();
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Warning << "Failed to resolve " << qname << ", got STL error: " << e.what() << endl,
- log->error(Logr::Warning, e.what(), msg, "exception", Logging::Loggable("std::exception")));
+ log->error(Logr::Warning, e.what(), msg, "exception", Logging::Loggable("std::exception"));
ret.clear();
}
catch (...) {
- SLOG(g_log << Logger::Warning << "Failed to resolve " << qname << ", got an exception" << endl,
- log->info(Logr::Warning, msg));
+ log->info(Logr::Warning, msg);
ret.clear();
}
}
}
catch (const PDNSException& e) {
- SLOG(g_log << Logger::Error << "Failed to update . records, got an exception: " << e.reason << endl,
- log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("PDNSException")));
+ log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("PDNSException"));
}
catch (const ImmediateServFailException& e) {
- SLOG(g_log << Logger::Error << "Failed to update . records, got an exception: " << e.reason << endl,
- log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("ImmediateServFailException")));
+ log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("ImmediateServFailException"));
}
catch (const PolicyHitException& policyHit) {
- SLOG(g_log << Logger::Error << "Failed to update . records, got a policy hit" << endl,
- log->info(Logr::Error, msg, "exception", Logging::Loggable("PolicyHitException"),
- "policyName", Logging::Loggable(resolver.d_appliedPolicy.getName())));
+ log->info(Logr::Error, msg, "exception", Logging::Loggable("PolicyHitException"),
+ "policyName", Logging::Loggable(resolver.d_appliedPolicy.getName()));
ret.clear();
}
catch (const std::exception& e) {
- SLOG(g_log << Logger::Error << "Failed to update . records, got an exception: " << e.what() << endl,
- log->error(Logr::Error, e.what(), msg, "exception", Logging::Loggable("std::exception")));
+ log->error(Logr::Error, e.what(), msg, "exception", Logging::Loggable("std::exception"));
}
catch (...) {
- SLOG(g_log << Logger::Error << "Failed to update . records, got an exception" << endl,
- log->info(Logr::Error, msg));
+ log->info(Logr::Error, msg);
}
if (res == 0) {
- SLOG(g_log << Logger::Debug << "Refreshed . records" << endl,
- log->info(Logr::Debug, "Refreshed . records"));
+ log->info(Logr::Debug, "Refreshed . records");
}
else {
- SLOG(g_log << Logger::Warning << "Failed to update root NS records, RCODE=" << res << endl,
- log->info(Logr::Warning, msg, "rcode", Logging::Loggable(res)));
+ log->info(Logr::Warning, msg, "rcode", Logging::Loggable(res));
}
return res;
}
if (g_dnssecmode == DNSSECMode::Off) {
if (!msg.empty()) {
auto log = g_slog->withName("config");
- SLOG(g_log << Logger::Warning << msg << endl,
- log->info(Logr::Warning, msg));
+ log->info(Logr::Warning, msg);
}
return true;
}
}
}
if (dsAnchors == newDSAnchors) {
- SLOG(g_log << Logger::Debug << "Read Trust Anchors from file, no changes detected" << endl,
- log->info(Logr::Debug, "Read Trust Anchors from file, no changes detected"));
+ log->info(Logr::Debug, "Read Trust Anchors from file, no changes detected");
return false;
}
- SLOG(g_log << Logger::Info << "Read changed Trust Anchors from file, updating" << endl,
- log->info(Logr::Info, "Read changed Trust Anchors from file, updating"));
+ log->info(Logr::Info, "Read changed Trust Anchors from file, updating");
dsAnchors = std::move(newDSAnchors);
return true;
}