logging/sqlite: Recognize Log::default_logdir and place files there if set

This commit is contained in:
Arne Welzel 2022-07-06 12:13:32 +02:00
parent aaa47a709c
commit 93584c7c7f
5 changed files with 78 additions and 2 deletions

View file

@ -10,6 +10,7 @@
#include "zeek/logging/writers/sqlite/sqlite.bif.h"
#include "zeek/threading/SerialTypes.h"
#include "zeek/util.h"
using namespace std;
using zeek::threading::Field;
@ -128,8 +129,11 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields, const Field* con
num_fields = arg_num_fields;
fields = arg_fields;
string fullpath(info.path);
fullpath.append(".sqlite");
auto fullpath = zeek::filesystem::path(
zeek::id::find_const<StringVal>("Log::default_logdir")->ToStdString());
fullpath /= info.path;
fullpath += ".sqlite";
string tablename;
WriterInfo::config_map::const_iterator it = info.config.find("tablename");