Add a rndc command to close currently open log files

The new command is 'rndc closelogs'.
This commit is contained in:
Mark Andrews 2024-06-19 10:20:33 +10:00
parent 78aa4466fe
commit 56c1f4aef2
3 changed files with 14 additions and 0 deletions

View 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)) {

View 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"

View 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.