mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Merge branch 'topic/robin/rotation-pp'
* topic/robin/rotation-pp: Adding a default_path_func that makes the default naming scheme script-level controlled. Reworking logging's postprocessor logic. Conflicts: scripts/base/frameworks/logging/main.bro testing/btest/policy/frameworks/logging/rotate-custom.bro
This commit is contained in:
commit
bbb0b855a2
16 changed files with 263 additions and 173 deletions
|
@ -26,4 +26,19 @@ export {
|
|||
const unset_field = "-" &redef;
|
||||
}
|
||||
|
||||
# Default function to postprocess a rotated ASCII log file. It moves the rotated
|
||||
# file to a new name that includes a timestamp with the opening time, and then
|
||||
# runs the writer's default postprocessor command on it.
|
||||
function default_rotation_postprocessor_func(info: Log::RotationInfo) : bool
|
||||
{
|
||||
# Move file to name including both opening and closing time.
|
||||
local dst = fmt("%s.%s.log", info$path,
|
||||
strftime(Log::default_rotation_date_format, info$open));
|
||||
|
||||
system(fmt("/bin/mv %s %s", info$fname, dst));
|
||||
|
||||
# Run default postprocessor.
|
||||
return Log::run_rotation_postprocessor_cmd(info, dst);
|
||||
}
|
||||
|
||||
redef Log::default_rotation_postprocessors += { [Log::WRITER_ASCII] = default_rotation_postprocessor_func };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue