From: Remi Gacogne Date: Thu, 21 Apr 2022 09:45:16 +0000 (+0200) Subject: dnsdist: Add setVerbose() to switch the verbose mode at runtime X-Git-Tag: auth-4.8.0-alpha0~110^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89d0e8ce025de595be70b2697baf413b6e25fd95;p=thirdparty%2Fpdns.git dnsdist: Add setVerbose() to switch the verbose mode at runtime And also from the configuration, without having to edit the arguments passed to the program. --- diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 3a3073e3db..0cc8e2b433 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -693,6 +693,7 @@ const std::vector g_consoleKeywords{ { "setUDPMultipleMessagesVectorSize", true, "n", "set the size of the vector passed to recvmmsg() to receive UDP messages. Default to 1 which means that the feature is disabled and recvmsg() is used instead" }, { "setUDPSocketBufferSizes", true, "recv, send", "Set the size of the receive (SO_RCVBUF) and send (SO_SNDBUF) buffers for incoming UDP sockets" }, { "setUDPTimeout", true, "n", "set the maximum time dnsdist will wait for a response from a backend over UDP, in seconds" }, + { "setVerbose", true, "bool", "set whether log messages at the verbose level will be logged" }, { "setVerboseHealthChecks", true, "bool", "set whether health check errors will be logged" }, { "setWebserverConfig", true, "[{password=string, apiKey=string, customHeaders, statsRequireAuthentication}]", "Updates webserver configuration" }, { "setWeightedBalancingFactor", true, "factor", "Set the balancing factor for bounded-load weighted policies (whashed, wrandom)" }, diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index c8b2bc1be7..65d7a3d13a 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -1713,7 +1713,9 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) return pool; }); + luaCtx.writeFunction("setVerbose", [](bool verbose) { g_verbose = verbose; }); luaCtx.writeFunction("setVerboseHealthChecks", [](bool verbose) { g_verboseHealthChecks = verbose; }); + luaCtx.writeFunction("setStaleCacheEntriesTTL", [](uint64_t ttl) { checkParameterBound("setStaleCacheEntriesTTL", ttl, std::numeric_limits::max()); g_staleCacheEntriesTTL = ttl; diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index d77dfc168a..f30de7b3ab 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -1055,6 +1055,14 @@ Status, Statistics and More :param {str} selectors: A lua table of selectors. Only queries matching all selectors are shown :param int num: Show a maximum of ``num`` recent queries+responses, default is 10. +.. function:: setVerboseHealthChecks(verbose) + + .. versionadded:: 1.8.0 + + Set whether log messages issued at the verbose level should be logged. This is turned off by default. + + :param bool verbose: Set to true if you want to enable verbose logging + .. function:: setVerboseHealthChecks(verbose) Set whether health check errors should be logged. This is turned off by default.