mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Fix broctl cluster log rotation (addresses #619)
Before Log::rotation_control was removed in fe38c22d
, it was used to
lookup rotation inverval at the time of installing a rotation timer,
and could fall back on the &default=default_rotation_inverval. But
now since filter rotation information is instead transferred to a Writer
when it's created, it also needed to be taught to fall back on the
default rotation interval.
This commit is contained in:
parent
f53d5fe0b9
commit
39af63841b
1 changed files with 11 additions and 1 deletions
|
@ -1266,7 +1266,9 @@ LogWriter* LogMgr::CreateWriter(EnumVal* id, EnumVal* writer, string path,
|
||||||
winfo->postprocessor = 0;
|
winfo->postprocessor = 0;
|
||||||
|
|
||||||
// Search for a corresponding filter for the writer/path pair and use its
|
// Search for a corresponding filter for the writer/path pair and use its
|
||||||
// rotation settings.
|
// rotation settings. If no matching filter, is found fall back on
|
||||||
|
// looking up the logging framework's default rotation interval.
|
||||||
|
bool found_filter_match = false;
|
||||||
list<Filter*>::const_iterator it;
|
list<Filter*>::const_iterator it;
|
||||||
for ( it = stream->filters.begin(); it != stream->filters.end(); ++it )
|
for ( it = stream->filters.begin(); it != stream->filters.end(); ++it )
|
||||||
{
|
{
|
||||||
|
@ -1274,12 +1276,20 @@ LogWriter* LogMgr::CreateWriter(EnumVal* id, EnumVal* writer, string path,
|
||||||
if ( f->writer->AsEnum() == writer->AsEnum() &&
|
if ( f->writer->AsEnum() == writer->AsEnum() &&
|
||||||
f->path == winfo->writer->Path() )
|
f->path == winfo->writer->Path() )
|
||||||
{
|
{
|
||||||
|
found_filter_match = true;
|
||||||
winfo->interval = f->interval;
|
winfo->interval = f->interval;
|
||||||
winfo->postprocessor = f->postprocessor;
|
winfo->postprocessor = f->postprocessor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! found_filter_match )
|
||||||
|
{
|
||||||
|
ID* id = global_scope()->Lookup("Log::default_rotation_interval");
|
||||||
|
assert(id);
|
||||||
|
winfo->interval = id->ID_Val()->AsInterval();
|
||||||
|
}
|
||||||
|
|
||||||
InstallRotationTimer(winfo);
|
InstallRotationTimer(winfo);
|
||||||
|
|
||||||
stream->writers.insert(
|
stream->writers.insert(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue