mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Added an option to the JSON formatter to use ISO 8601 for timestamps.
- It's not *exactly* ISO 8601 which doesn't seem to support subseconds, but subseconds are very important to us and most things that support ISO8601 seem to also support subseconds in the way I'm implemented it.
This commit is contained in:
parent
a56c343715
commit
c9aaf9e753
11 changed files with 77 additions and 13 deletions
|
@ -59,6 +59,7 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const Field* const *
|
|||
output_to_stdout = BifConst::LogAscii::output_to_stdout;
|
||||
include_meta = BifConst::LogAscii::include_meta;
|
||||
use_json = BifConst::LogAscii::use_json;
|
||||
json_iso_timestamps = BifConst::LogAscii::json_iso_timestamps;
|
||||
|
||||
separator.assign(
|
||||
(const char*) BifConst::LogAscii::separator->Bytes(),
|
||||
|
@ -147,7 +148,7 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const Field* const *
|
|||
if ( use_json )
|
||||
{
|
||||
// Write out JSON formatted logs.
|
||||
formatter = new threading::formatter::JSON(this);
|
||||
formatter = new threading::formatter::JSON(this, json_iso_timestamps);
|
||||
// Using JSON implicitly turns off the header meta fields.
|
||||
include_meta = false;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
bool include_meta;
|
||||
bool tsv;
|
||||
bool use_json;
|
||||
bool json_iso_timestamps;
|
||||
|
||||
string separator;
|
||||
string set_separator;
|
||||
|
|
|
@ -52,7 +52,7 @@ ElasticSearch::ElasticSearch(WriterFrontend* frontend) : WriterBackend(frontend)
|
|||
|
||||
curl_handle = HTTPSetup();
|
||||
|
||||
json = new threading::formatter::JSON(this);
|
||||
json = new threading::formatter::JSON(this, false);
|
||||
}
|
||||
|
||||
ElasticSearch::~ElasticSearch()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue