Introduce script-land variable that can be used to set logdir.

Addresses GH-772
This commit is contained in:
Henrik Kramselund Jereminsen 2021-05-11 09:25:24 +02:00 committed by Johanna Amann
parent 672504e265
commit 6bde33aca7
4 changed files with 22 additions and 1 deletions

View file

@ -252,6 +252,12 @@ void Ascii::InitConfigOptions()
(const char*) BifConst::LogAscii::gzip_file_extension->Bytes(),
BifConst::LogAscii::gzip_file_extension->Len()
);
logdir.assign(
(const char*) BifConst::LogAscii::logdir->Bytes(),
BifConst::LogAscii::logdir->Len()
);
}
bool Ascii::InitFilterOptions()
@ -344,6 +350,9 @@ bool Ascii::InitFilterOptions()
else if ( strcmp(i->first, "gzip_file_extension") == 0 )
gzip_file_extension.assign(i->second);
else if ( strcmp(i->first, "logdir") == 0 )
logdir.assign(i->second);
}
if ( ! InitFormatter() )
@ -448,6 +457,11 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const threading::Fiel
ext += gzip_file_extension.empty() ? "gz" : gzip_file_extension;
}
if ( ! logdir.empty() )
{
fname = logdir.empty() ? fname : logdir + "/" + fname;
}
fname += ext;
bool use_shadow = BifConst::LogAscii::enable_leftover_log_rotation && Info().rotation_interval > 0;