mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Add unrolling separator & field name map to logging framework.
- When a log record is being "unrolled" (sub-records flattened out into a single record), it's now possible to choose the character/string to separate the outer name from the inner name. This can be used to work around the problems with ElasticSearch 2.0 not supporting dots "." in field names. This value can be provided per-filter as well as a global default value. - Log fields can be renamed by providing a table per-filter (or a global default) to rename fields for any log writer. The name translation is performed after unrolling so the value in the field name table must match whatever is being used to separate field names. For example if the unrolling separator was set to "*": redef Log::default_unrolling_sep = "*"; The field name map would need to reflect it: redef Log::default_field_name_map = { ["id*orig_h"] = "src", ["id*orig_p"] = "src_port", ["id*resp_h"] = "dst", ["id*resp_p"] = "dst_port", };
This commit is contained in:
parent
8f6cdbb489
commit
b28801ce95
8 changed files with 200 additions and 1 deletions
|
@ -0,0 +1,11 @@
|
|||
# @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT
|
||||
# @TEST-EXEC: btest-diff conn.log
|
||||
|
||||
@load base/protocols/conn
|
||||
|
||||
redef Log::default_field_name_map = {
|
||||
["id.orig_h"] = "src",
|
||||
["id.orig_p"] = "src_port",
|
||||
["id.resp_h"] = "dst",
|
||||
["id.resp_p"] = "dst_port",
|
||||
};
|
|
@ -0,0 +1,6 @@
|
|||
# @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT
|
||||
# @TEST-EXEC: btest-diff conn.log
|
||||
|
||||
@load base/protocols/conn
|
||||
|
||||
redef Log::default_unrolling_sep = "_";
|
|
@ -0,0 +1,15 @@
|
|||
# This tests the order in which the unrolling and field name
|
||||
# renaming occurs.
|
||||
|
||||
# @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT
|
||||
# @TEST-EXEC: btest-diff conn.log
|
||||
|
||||
@load base/protocols/conn
|
||||
|
||||
redef Log::default_unrolling_sep = "*";
|
||||
redef Log::default_field_name_map = {
|
||||
["id*orig_h"] = "src",
|
||||
["id*orig_p"] = "src_port",
|
||||
["id*resp_h"] = "dst",
|
||||
["id*resp_p"] = "dst_port",
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue