zeek/testing/btest/scripts/base/frameworks/file-analysis/log-files-event-flattening.zeek
Arne Welzel d2314d2666 files.log: Unroll and introduce uid and id fields
This is a script-only change that unrolls File::Info records into
multiple files.log entries if the same file was seen over different
connections by single worker. Consequently, the File::Info record
gets the commonly used uid and id fields added. These fields are
optional for File::Info - a file may be analyzed without relation
to a network connection (e.g by using Input::add_analysis()).

The existing tx_hosts, rx_hosts and conn_uids fields of Files::Info
are not meaningful after this change and removed by default. Therefore,
files.log will have them removed, too.

The tx_hosts, rx_hosts and conn_uids fields can be revived by using the
policy script frameworks/files/deprecated-txhosts-rxhosts-connuids.zeek
included in the distribution. However, with v6.1 this script will be
removed.
2022-08-16 17:22:20 +02:00

26 lines
869 B
Text

# @TEST-DOC: Implement Files::log_files and verify it is seeing unique File::Info records.
# @TEST-EXEC: zeek -b -r $TRACES/http/concurrent-range-requests.pcap uid-id.zeek >out.new
# @TEST-EXEC: zeek -b -r $TRACES/http/concurrent-range-requests.pcap frameworks/files/deprecated-txhosts-rxhosts-connuids uid-id-deprecated.zeek >out.deprecated
# @TEST-EXEC: btest-diff out.new
# @TEST-EXEC: btest-diff out.deprecated
@TEST-START-FILE uid-id.zeek
@load base/frameworks/files
@load base/protocols/http
event Files::log_files(rec: Files::Info)
{
print rec$uid, rec$id;
}
@TEST-END-FILE
@TEST-START-FILE uid-id-deprecated.zeek
@load base/frameworks/files
@load base/protocols/http
event Files::log_files(rec: Files::Info)
{
print rec$uid, rec$id, cat(rec$tx_hosts), cat(rec$rx_hosts), cat(rec$conn_uids);
}
@TEST-END-FILE