mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Logdir: Change requested by 0xxon, no problem
Suggestion from 0xxon to look at Input Framework inspired this change
This commit is contained in:
parent
6bde33aca7
commit
74561e922f
2 changed files with 11 additions and 4 deletions
|
@ -57,7 +57,7 @@ export {
|
||||||
## Default logs to current directory
|
## Default logs to current directory
|
||||||
## Can be redefined to send files into logging directory
|
## Can be redefined to send files into logging directory
|
||||||
##
|
##
|
||||||
const logdir = "." &redef;
|
const logdir = "" &redef;
|
||||||
|
|
||||||
## Format of timestamps when writing out JSON. By default, the JSON
|
## Format of timestamps when writing out JSON. By default, the JSON
|
||||||
## formatter will use double values for timestamps which represent the
|
## formatter will use double values for timestamps which represent the
|
||||||
|
|
|
@ -457,10 +457,17 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const threading::Fiel
|
||||||
ext += gzip_file_extension.empty() ? "gz" : gzip_file_extension;
|
ext += gzip_file_extension.empty() ? "gz" : gzip_file_extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! logdir.empty() )
|
if ( fname.front() != '/' && ! logdir.empty() )
|
||||||
{
|
{
|
||||||
fname = logdir.empty() ? fname : logdir + "/" + fname;
|
string path = logdir;
|
||||||
}
|
std::size_t last = path.find_last_not_of('/');
|
||||||
|
|
||||||
|
if ( last == string::npos ) // Nothing but slashes -- weird but ok...
|
||||||
|
path = "/";
|
||||||
|
else
|
||||||
|
path.erase(last + 1);
|
||||||
|
fname = path + "/" + fname;
|
||||||
|
}
|
||||||
|
|
||||||
fname += ext;
|
fname += ext;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue