]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add setVerbose() to switch the verbose mode at runtime
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 21 Apr 2022 09:45:16 +0000 (11:45 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 21 Apr 2022 09:45:16 +0000 (11:45 +0200)
And also from the configuration, without having to edit the arguments
passed to the program.

pdns/dnsdist-console.cc
pdns/dnsdist-lua.cc
pdns/dnsdistdist/docs/reference/config.rst

index 3a3073e3db1679ee73c7d56bad1d2126af858672..0cc8e2b4334bb9564e94dfcb2cb93db762c6710b 100644 (file)
@@ -693,6 +693,7 @@ const std::vector<ConsoleKeyword> 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)" },
index c8b2bc1be727f2f2d34e1c642a363a861c995ad8..65d7a3d13ab9db80b9b1b8ee10870fff7c018c30 100644 (file)
@@ -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<uint32_t>::max());
     g_staleCacheEntriesTTL = ttl;
index d77dfc168a0f14f91e3e7f271599b8b753c08bd8..f30de7b3ab709c8179a944417fa0d8113c7491c5 100644 (file)
@@ -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.