mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
Implement leftover log rotation/archival for supervised nodes
This helps prevent a node from being killed/crashing in the middle of writing a log, restarting, and eventually clobbering that log file that never underwent the rotation/archival process. The old `archive-log` and `post-terminate` scripts as used by ZeekControl previously implemented this behavior, but the new logic is entirely in the ASCII writer. It uses ".shadow" log files stored alongside the real log to help detect such scenarios and rotate them correctly upon the next startup of the Zeek process.
This commit is contained in:
parent
a46e24091a
commit
11949ce37a
11 changed files with 523 additions and 17 deletions
|
@ -61,6 +61,15 @@ public:
|
|||
*/
|
||||
const char* path;
|
||||
|
||||
/**
|
||||
* The name of the postprocessor function that will be called
|
||||
* upon the logging manager processing the "rotation finished"
|
||||
* message. A null or empty value means "use the default function".
|
||||
*
|
||||
* Structure takes ownership of string.
|
||||
*/
|
||||
const char* post_proc_func = nullptr;
|
||||
|
||||
/**
|
||||
* The rotation interval as configured for this writer.
|
||||
*/
|
||||
|
@ -90,6 +99,7 @@ public:
|
|||
WriterInfo(const WriterInfo& other)
|
||||
{
|
||||
path = other.path ? copy_string(other.path) : nullptr;
|
||||
post_proc_func = other.post_proc_func ? copy_string(other.post_proc_func) : nullptr;
|
||||
rotation_interval = other.rotation_interval;
|
||||
rotation_base = other.rotation_base;
|
||||
network_time = other.network_time;
|
||||
|
@ -101,6 +111,7 @@ public:
|
|||
~WriterInfo()
|
||||
{
|
||||
delete [] path;
|
||||
delete [] post_proc_func;
|
||||
|
||||
for ( config_map::iterator i = config.begin(); i != config.end(); i++ )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue