zeek/testing/btest/policy/frameworks/logging/rotate-custom.bro
Jon Siwek 0d4be5d772 Fixing tests / updating baselines.
- core.load-unload: scripts that get loaded by default changed, so to
  make the test insensitive to that in the future, I changed the test
  to just check that the stdout is empty (the @unload'd script would have
  had output there)

- policy.frameworks.logging.rotate-custom: I saw that the ordering of
  the log postprocessor output caused a failure for me even though the
  overall content was the same, so it now sorts that part before diff'ing

- core.print-bpf-filters-ipv[4|6]: packet-filter log file name changed

- policy.protocols.conn.known-services: logging file names changes and
  local_nets is now in the Site module
2011-06-29 12:34:14 -05:00

37 lines
969 B
Text

#
# @TEST-EXEC: bro -r %DIR/rotation.trace %INPUT | egrep "test|test2" | sort >out
# @TEST-EXEC: for i in `ls test*.log | sort`; do printf '> %s\n' $i; cat $i; done | sort | uniq >>out
# @TEST-EXEC: btest-diff out
module Test;
export {
# Create a new ID for our log stream
redef enum Log::ID += { Test };
# Define a record with all the columns the log file can have.
# (I'm using a subset of fields from ssh-ext for demonstration.)
type Log: record {
t: time;
id: conn_id; # Will be rolled out into individual columns.
} &log;
}
redef Log::default_rotation_interval = 1hr;
redef Log::default_rotation_postprocessor = "echo 1st";
redef Log::rotation_control += {
[Log::WRITER_ASCII, "test2"] = [$interv=30mins, $postprocessor="echo 2nd"]
};
event bro_init()
{
Log::create_stream(Test, [$columns=Log]);
Log::add_filter(Test, [$name="2nd", $path="test2"]);
}
event new_connection(c: connection)
{
Log::write(Test, [$t=network_time(), $id=c$id]);
}