Windows: Rotating the log file
rgsub1 at btinternet.com
Sat Jan 9 16:22:28 UTC 2021
Thanks for the pointer Yuri,
I took a look and it would appear to work in the same way that I had envisaged. The unbound process has to be stopped to gain access, the log file renamed and unbound restarted at which point it will create a new log file.
The program I have been using takes just under 0.6 Seconds to achieve that process but during that time any requests that were made that have outstanding replies and any new requests will fail. I have noticed that on several occasions this has caused a process to have issues.
I see there is a “log_reopen” facility in the “unbound_control.exe” but it is not clear at all how this can be used. If Unbound, when this command was used, renamed the log file and then started a new one it would fulfil the necessary requirements but alas the log file remains inaccessible. Even if the log_reopen would relinquish its hold on the file for a set time period then an external program could achieve what is required.
I suspect the best option is for unbound to rename the file as at that point is has full control over what is happening and hopefully buffer new log entries. There could be configuration items to give the new name for the log file and perhaps for how large the log file could be for each given verbosity level. If the date/time were appended to the name that it would always be unique.
Would this be a reasonable suggestion given I have not found or seen any other way apart from the stop/rename/start method I am currently using which has issues.
From: Yuri <yvoinov at gmail.com>
Sent: 06 January 2021 12:25
To: unbound-users at lists.nlnetlabs.nl
Subject: Re: Windows: Rotating the log file
Try this one:
03.01.2021 18:07, RayG via Unbound-users пишет:
Is there a method to rotate the unbound log file in windows?
Access to the file is denied in all cases unless the unbound server is stopped.
In order to get the create time of a new log file set correctly the server must be stopped for at least 15 seconds due to “File System Tunnelling” see:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Unbound-users