]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add a rndc command to close currently open log files
authorMark Andrews <marka@isc.org>
Wed, 19 Jun 2024 00:20:33 +0000 (10:20 +1000)
committerMark Andrews <marka@isc.org>
Wed, 31 Jul 2024 07:36:38 +0000 (17:36 +1000)
The new command is 'rndc closelogs'.

bin/named/control.c
bin/named/include/named/control.h
bin/rndc/rndc.rst

index a3e009799e3316e552421515ac11ced7d6ca7c43..d2aa5a92605eaf9ff5e28363d43f63462f11e0ee 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 
 #include <isc/lex.h>
+#include <isc/log.h>
 #include <isc/mem.h>
 #include <isc/result.h>
 #include <isc/string.h>
@@ -201,6 +202,9 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
                   command_compare(command, NAMED_COMMAND_MODZONE))
        {
                result = named_server_changezone(named_g_server, cmdline, text);
+       } else if (command_compare(command, NAMED_COMMAND_CLOSELOGS)) {
+               isc_log_closefilelogs(named_g_lctx);
+               result = ISC_R_SUCCESS;
        } else if (command_compare(command, NAMED_COMMAND_DELZONE)) {
                result = named_server_delzone(named_g_server, lex, text);
        } else if (command_compare(command, NAMED_COMMAND_DNSSEC)) {
index c01cb7b00e1112e1f25261823e4366129c160c25..6f3660ad0f4487b41867cc8c5967aa25c48d7594 100644 (file)
@@ -29,6 +29,7 @@
 #define NAMED_CONTROL_PORT 953
 
 #define NAMED_COMMAND_ADDZONE     "addzone"
+#define NAMED_COMMAND_CLOSELOGS           "closelogs"
 #define NAMED_COMMAND_DELZONE     "delzone"
 #define NAMED_COMMAND_DNSSEC      "dnssec"
 #define NAMED_COMMAND_DNSTAP      "dnstap"
index da9f0710e4525c5eb1d356c9784fef194517ba55..62603d1da8b16e46aca26e57c80c1be16fd199e8 100644 (file)
@@ -152,6 +152,15 @@ Currently supported commands are:
 
    See also :option:`rndc delzone` and :option:`rndc modzone`.
 
+.. option:: closelogs
+
+   This command closes currently open log files.  It is intended to be used
+   by external log rotation tools following this proceedure.
+
+   1) rename the log files
+   2) run ``rndc closelogs``
+   3) optionally compress the log files
+
 .. option:: delzone [-clean] zone [class [view]]
 
    This command deletes a zone while the server is running.