mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Reworking logging's postprocessor logic.
The main change is that the postprocessor commands are no longer run by the log writers themselves. Instead, the writers send back a message to the log mgr once they have rotated. The manager then calls a script level function to do somethign with the rotated file. By default, it will be renamed to somethingn nice and then a postprocessor shell command will be run on it if defined. Pieces going into this: - Terminology change: "postprocessor" now refers to a script *function*. In addition, there are "postprocessor commands", which are shell commands that may be triggered by the function to run on a rotated file. - The RotationInfo record now comes with all the information that was previously provided internally to the C++ function running the post-processor command. - Changing the default time format to %Y-%m-%d-%H-%M-%S - rotation_path_func is gone - The default postprocessor function is defined individually by each LogWriter in frameworks/logging/plugin/* - The interface to postprocessor shell commands remains the same. Needs a bit more testing ...
This commit is contained in:
parent
0e5bc16a60
commit
96a9d488e0
14 changed files with 225 additions and 160 deletions
|
@ -242,7 +242,7 @@ bool LogWriterAscii::DoWrite(int num_fields, const LogField* const * fields,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool LogWriterAscii::DoRotate(string rotated_path, string postprocessor, double open,
|
||||
bool LogWriterAscii::DoRotate(string rotated_path, double open,
|
||||
double close, bool terminating)
|
||||
{
|
||||
if ( IsSpecial(Path()) )
|
||||
|
@ -254,10 +254,8 @@ bool LogWriterAscii::DoRotate(string rotated_path, string postprocessor, double
|
|||
string nname = rotated_path + ".log";
|
||||
rename(fname.c_str(), nname.c_str());
|
||||
|
||||
if ( postprocessor.size() &&
|
||||
! RunPostProcessor(nname, postprocessor, fname.c_str(),
|
||||
open, close, terminating) )
|
||||
return false;
|
||||
if ( ! FinishedRotation(nname, fname, open, close, terminating) )
|
||||
Error(Fmt("error rotating %s to %s", fname.c_str(), nname.c_str()));
|
||||
|
||||
return DoInit(Path(), NumFields(), Fields());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue