mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
logging/ascii: Support leftover log rotation in non-supervisor setups
We have a use case to rotate leftover log files in a non-supervisor setup. There doesn't seem to be a strict requirement on supervisor functionality. Allow enabling leftover log rotation through LogAscii::enable_leftover_log_rotation and redef this for the logger node in a supervisor setup individually.
This commit is contained in:
parent
c8545c85d8
commit
1f5ab4878b
4 changed files with 12 additions and 4 deletions
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "Func.h"
|
||||
#include "RunState.h"
|
||||
#include "supervisor/Supervisor.h"
|
||||
#include "logging/Manager.h"
|
||||
#include "threading/SerialTypes.h"
|
||||
|
||||
|
@ -450,7 +449,7 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const threading::Fiel
|
|||
|
||||
fname += ext;
|
||||
|
||||
bool use_shadow = Supervisor::ThisNode() && info.rotation_interval > 0;
|
||||
bool use_shadow = BifConst::LogAscii::enable_leftover_log_rotation && Info().rotation_interval > 0;
|
||||
|
||||
if ( use_shadow )
|
||||
{
|
||||
|
@ -667,7 +666,7 @@ bool Ascii::DoRotate(const char* rotated_path, double open, double close, bool t
|
|||
return false;
|
||||
}
|
||||
|
||||
bool use_shadow = Supervisor::ThisNode() && Info().rotation_interval > 0;
|
||||
bool use_shadow = BifConst::LogAscii::enable_leftover_log_rotation && Info().rotation_interval > 0;
|
||||
|
||||
if ( use_shadow )
|
||||
{
|
||||
|
@ -744,7 +743,7 @@ static std::vector<LeftoverLog> find_leftover_logs()
|
|||
|
||||
void Ascii::RotateLeftoverLogs()
|
||||
{
|
||||
if ( ! Supervisor::ThisNode() )
|
||||
if ( ! BifConst::LogAscii::enable_leftover_log_rotation )
|
||||
return;
|
||||
|
||||
// Log file crash recovery: if there's still leftover shadow files from the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue