logging: Introduce Log::default_logdir deprecate LogAscii::logdir and per writer logdir

Also modify FormatRotationPath to keep rotated logs within
Log::default_logdir unless the rotation function explicitly
set dir, e.g. by when the user redef'ed default_rotation_interval.
This commit is contained in:
Arne Welzel 2022-06-30 16:07:04 +02:00
parent 513ea7e04f
commit aaa47a709c
15 changed files with 272 additions and 5 deletions

View file

@ -26,6 +26,13 @@ export {
## Default writer to use if a filter does not specify anything else.
const default_writer = WRITER_ASCII &redef;
## Default logging directory. An empty string implies using the
## current working directory.
## This directory is also used for rotated logs in cases where
## :zeek:see:`Log::rotation_format_func` returns a record with
## an empty or unset ``dir`` field.
const default_logdir = "" &redef;
## Default separator to use between fields.
## Individual writers can use a different value.
const separator = "\t" &redef;

View file

@ -57,7 +57,10 @@ export {
## Define the default logging directory. If empty, logs are written
## to the current working directory.
##
const logdir = "" &redef;
## This setting is superseeded by :zeek:see:`Log::default_logdir`. The
## latter applies to all file writers and also interacts better with
## log rotation.
const logdir = "" &redef &deprecated="Remove in v6.1. Use 'Log::default_logdir'.";
## Format of timestamps when writing out JSON. By default, the JSON
## formatter will use double values for timestamps which represent the