mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
Merge remote-tracking branch 'origin/master' into topic/bernhard/input-allow_invalid_types
This commit is contained in:
commit
1498a3bd59
30 changed files with 274 additions and 79 deletions
45
CHANGES
45
CHANGES
|
@ -1,4 +1,49 @@
|
||||||
|
|
||||||
|
2.1-beta-31 | 2012-08-21 15:46:05 -0700
|
||||||
|
|
||||||
|
* Tweak to rotate-custom.bro unit test. (Jon Siwek)
|
||||||
|
|
||||||
|
* Ignore small mem leak every rotation interval for dataseries logs.
|
||||||
|
(Jon Siwek)
|
||||||
|
|
||||||
|
2.1-beta-28 | 2012-08-21 08:32:42 -0700
|
||||||
|
|
||||||
|
* Linking ES docs into logging document. (Robin Sommer)
|
||||||
|
|
||||||
|
2.1-beta-27 | 2012-08-20 20:06:20 -0700
|
||||||
|
|
||||||
|
* Add the Stream record to Log:active_streams to make more dynamic
|
||||||
|
logging possible. (Seth Hall)
|
||||||
|
|
||||||
|
* Fix portability of printing to files returned by
|
||||||
|
open("/dev/stderr"). (Jon Siwek)
|
||||||
|
|
||||||
|
* Fix mime type diff canonifier to also skip mime_desc columns. (Jon
|
||||||
|
Siwek)
|
||||||
|
|
||||||
|
* Unit test tweaks/fixes. (Jon Siwek)
|
||||||
|
|
||||||
|
- Some baselines for tests in "leaks" group were outdated.
|
||||||
|
|
||||||
|
- Changed a few of the cluster/communication tests to terminate
|
||||||
|
more explicitly instead of relying on btest-bg-wait to kill
|
||||||
|
processes. This makes the tests finish faster in the success case
|
||||||
|
and makes the reason for failing clearer in the that case.
|
||||||
|
|
||||||
|
* Fix memory leak of serialized IDs when compiled with
|
||||||
|
--enable-debug. (Jon Siwek)
|
||||||
|
|
||||||
|
2.1-beta-21 | 2012-08-16 11:48:56 -0700
|
||||||
|
|
||||||
|
* Installing a handler for running out of memory in "new". Bro will
|
||||||
|
now print an error message in that case rather than abort with an
|
||||||
|
uncaught exception. (Robin Sommer)
|
||||||
|
|
||||||
|
2.1-beta-20 | 2012-08-16 11:43:31 -0700
|
||||||
|
|
||||||
|
* Fixed potential problems with ElasticSearch output plugin. (Seth
|
||||||
|
Hall)
|
||||||
|
|
||||||
2.1-beta-13 | 2012-08-10 12:28:04 -0700
|
2.1-beta-13 | 2012-08-10 12:28:04 -0700
|
||||||
|
|
||||||
* Reporter warnings and error now print to stderr by default. New
|
* Reporter warnings and error now print to stderr by default. New
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.0-914
|
2.1-beta-31
|
||||||
|
|
|
@ -383,3 +383,4 @@ Bro supports the following output formats other than ASCII:
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
logging-dataseries
|
logging-dataseries
|
||||||
|
logging-elasticsearch
|
||||||
|
|
|
@ -329,9 +329,9 @@ export {
|
||||||
global run_rotation_postprocessor_cmd: function(info: RotationInfo, npath: string) : bool;
|
global run_rotation_postprocessor_cmd: function(info: RotationInfo, npath: string) : bool;
|
||||||
|
|
||||||
## The streams which are currently active and not disabled.
|
## The streams which are currently active and not disabled.
|
||||||
## This set is not meant to be modified by users! Only use it for
|
## This table is not meant to be modified by users! Only use it for
|
||||||
## examining which streams are active.
|
## examining which streams are active.
|
||||||
global active_streams: set[ID] = set();
|
global active_streams: table[ID] of Stream = table();
|
||||||
}
|
}
|
||||||
|
|
||||||
# We keep a script-level copy of all filters so that we can manipulate them.
|
# We keep a script-level copy of all filters so that we can manipulate them.
|
||||||
|
@ -417,7 +417,7 @@ function create_stream(id: ID, stream: Stream) : bool
|
||||||
if ( ! __create_stream(id, stream) )
|
if ( ! __create_stream(id, stream) )
|
||||||
return F;
|
return F;
|
||||||
|
|
||||||
add active_streams[id];
|
active_streams[id] = stream;
|
||||||
|
|
||||||
return add_default_filter(id);
|
return add_default_filter(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ export {
|
||||||
|
|
||||||
## Optionally ignore any :bro:type:`Log::ID` from being sent to
|
## Optionally ignore any :bro:type:`Log::ID` from being sent to
|
||||||
## ElasticSearch with this script.
|
## ElasticSearch with this script.
|
||||||
const excluded_log_ids: set[string] = set("Communication::LOG") &redef;
|
const excluded_log_ids: set[Log::ID] &redef;
|
||||||
|
|
||||||
## If you want to explicitly only send certain :bro:type:`Log::ID`
|
## If you want to explicitly only send certain :bro:type:`Log::ID`
|
||||||
## streams, add them to this set. If the set remains empty, all will
|
## streams, add them to this set. If the set remains empty, all will
|
||||||
## be sent. The :bro:id:`LogElasticSearch::excluded_log_ids` option will remain in
|
## be sent. The :bro:id:`LogElasticSearch::excluded_log_ids` option will remain in
|
||||||
## effect as well.
|
## effect as well.
|
||||||
const send_logs: set[string] = set() &redef;
|
const send_logs: set[Log::ID] &redef;
|
||||||
}
|
}
|
||||||
|
|
||||||
event bro_init() &priority=-5
|
event bro_init() &priority=-5
|
||||||
|
@ -24,8 +24,8 @@ event bro_init() &priority=-5
|
||||||
|
|
||||||
for ( stream_id in Log::active_streams )
|
for ( stream_id in Log::active_streams )
|
||||||
{
|
{
|
||||||
if ( fmt("%s", stream_id) in excluded_log_ids ||
|
if ( stream_id in excluded_log_ids ||
|
||||||
(|send_logs| > 0 && fmt("%s", stream_id) !in send_logs) )
|
(|send_logs| > 0 && stream_id !in send_logs) )
|
||||||
next;
|
next;
|
||||||
|
|
||||||
local filter: Log::Filter = [$name = "default-es",
|
local filter: Log::Filter = [$name = "default-es",
|
||||||
|
|
23
src/File.cc
23
src/File.cc
|
@ -138,11 +138,22 @@ BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
||||||
BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
|
BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
f = 0;
|
||||||
name = copy_string(arg_name);
|
name = copy_string(arg_name);
|
||||||
access = copy_string(arg_access);
|
access = copy_string(arg_access);
|
||||||
t = arg_t ? arg_t : base_type(TYPE_STRING);
|
t = arg_t ? arg_t : base_type(TYPE_STRING);
|
||||||
if ( ! Open() )
|
|
||||||
|
if ( streq(name, "/dev/stdin") )
|
||||||
|
f = stdin;
|
||||||
|
else if ( streq(name, "/dev/stdout") )
|
||||||
|
f = stdout;
|
||||||
|
else if ( streq(name, "/dev/stderr") )
|
||||||
|
f = stderr;
|
||||||
|
|
||||||
|
if ( f )
|
||||||
|
is_open = 1;
|
||||||
|
|
||||||
|
else if ( ! Open() )
|
||||||
{
|
{
|
||||||
reporter->Error("cannot open %s: %s", name, strerror(errno));
|
reporter->Error("cannot open %s: %s", name, strerror(errno));
|
||||||
is_open = 0;
|
is_open = 0;
|
||||||
|
@ -342,8 +353,8 @@ int BroFile::Close()
|
||||||
|
|
||||||
FinishEncrypt();
|
FinishEncrypt();
|
||||||
|
|
||||||
// Do not close stdout/stderr.
|
// Do not close stdin/stdout/stderr.
|
||||||
if ( f == stdout || f == stderr )
|
if ( f == stdin || f == stdout || f == stderr )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( is_in_cache )
|
if ( is_in_cache )
|
||||||
|
@ -523,6 +534,10 @@ RecordVal* BroFile::Rotate()
|
||||||
if ( ! is_open )
|
if ( ! is_open )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Do not rotate stdin/stdout/stderr.
|
||||||
|
if ( f == stdin || f == stdout || f == stderr )
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ( okay_to_manage && ! is_in_cache )
|
if ( okay_to_manage && ! is_in_cache )
|
||||||
BringIntoCache();
|
BringIntoCache();
|
||||||
|
|
||||||
|
|
|
@ -2897,11 +2897,6 @@ void RemoteSerializer::GotID(ID* id, Val* val)
|
||||||
(desc && *desc) ? desc : "not set"),
|
(desc && *desc) ? desc : "not set"),
|
||||||
current_peer);
|
current_peer);
|
||||||
|
|
||||||
#ifdef USE_PERFTOOLS_DEBUG
|
|
||||||
// May still be cached, but we don't care.
|
|
||||||
heap_checker->IgnoreObject(id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Unref(id);
|
Unref(id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ Val::~Val()
|
||||||
|
|
||||||
Unref(type);
|
Unref(type);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Unref(bound_id);
|
delete [] bound_id;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/Val.h
16
src/Val.h
|
@ -347,13 +347,15 @@ public:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// For debugging, we keep a reference to the global ID to which a
|
// For debugging, we keep a reference to the global ID to which a
|
||||||
// value has been bound *last*.
|
// value has been bound *last*.
|
||||||
ID* GetID() const { return bound_id; }
|
ID* GetID() const
|
||||||
|
{
|
||||||
|
return bound_id ? global_scope()->Lookup(bound_id) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void SetID(ID* id)
|
void SetID(ID* id)
|
||||||
{
|
{
|
||||||
if ( bound_id )
|
delete [] bound_id;
|
||||||
::Unref(bound_id);
|
bound_id = id ? copy_string(id->Name()) : 0;
|
||||||
bound_id = id;
|
|
||||||
::Ref(bound_id);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -401,8 +403,8 @@ protected:
|
||||||
RecordVal* attribs;
|
RecordVal* attribs;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// For debugging, we keep the ID to which a Val is bound.
|
// For debugging, we keep the name of the ID to which a Val is bound.
|
||||||
ID* bound_id;
|
const char* bound_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -243,8 +243,25 @@ bool DataSeries::OpenLog(string path)
|
||||||
log_file->writeExtentLibrary(log_types);
|
log_file->writeExtentLibrary(log_types);
|
||||||
|
|
||||||
for( size_t i = 0; i < schema_list.size(); ++i )
|
for( size_t i = 0; i < schema_list.size(); ++i )
|
||||||
extents.insert(std::make_pair(schema_list[i].field_name,
|
{
|
||||||
GeneralField::create(log_series, schema_list[i].field_name)));
|
string fn = schema_list[i].field_name;
|
||||||
|
GeneralField* gf = 0;
|
||||||
|
#ifdef USE_PERFTOOLS_DEBUG
|
||||||
|
{
|
||||||
|
// GeneralField isn't cleaning up some results of xml parsing, reported
|
||||||
|
// here: https://github.com/dataseries/DataSeries/issues/1
|
||||||
|
// Ignore for now to make leak tests pass. There's confidence that
|
||||||
|
// we do clean up the GeneralField* since the ExtentSeries dtor for
|
||||||
|
// member log_series would trigger an assert if dynamically allocated
|
||||||
|
// fields aren't deleted beforehand.
|
||||||
|
HeapLeakChecker::Disabler disabler;
|
||||||
|
#endif
|
||||||
|
gf = GeneralField::create(log_series, fn);
|
||||||
|
#ifdef USE_PERFTOOLS_DEBUG
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
extents.insert(std::make_pair(fn, gf));
|
||||||
|
}
|
||||||
|
|
||||||
if ( ds_extent_size < ROW_MIN )
|
if ( ds_extent_size < ROW_MIN )
|
||||||
{
|
{
|
||||||
|
|
|
@ -371,7 +371,11 @@ bool ElasticSearch::HTTPSend(CURL *handle)
|
||||||
// The best (only?) way to disable that is to just use HTTP 1.0
|
// The best (only?) way to disable that is to just use HTTP 1.0
|
||||||
curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
|
curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
|
||||||
|
|
||||||
//curl_easy_setopt(handle, CURLOPT_TIMEOUT_MS, transfer_timeout);
|
// Some timeout options. These will need more attention later.
|
||||||
|
curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1);
|
||||||
|
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT_MS, transfer_timeout);
|
||||||
|
curl_easy_setopt(handle, CURLOPT_TIMEOUT_MS, transfer_timeout*2);
|
||||||
|
curl_easy_setopt(handle, CURLOPT_DNS_CACHE_TIMEOUT, 60*60);
|
||||||
|
|
||||||
CURLcode return_code = curl_easy_perform(handle);
|
CURLcode return_code = curl_easy_perform(handle);
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,8 @@ void terminate_bro()
|
||||||
delete log_mgr;
|
delete log_mgr;
|
||||||
delete thread_mgr;
|
delete thread_mgr;
|
||||||
delete reporter;
|
delete reporter;
|
||||||
|
|
||||||
|
reporter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void termination_signal()
|
void termination_signal()
|
||||||
|
@ -380,6 +382,8 @@ static void bro_new_handler()
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
std::set_new_handler(bro_new_handler);
|
||||||
|
|
||||||
brofiler.ReadStats();
|
brofiler.ReadStats();
|
||||||
|
|
||||||
bro_argc = argc;
|
bro_argc = argc;
|
||||||
|
|
|
@ -1383,7 +1383,13 @@ void safe_close(int fd)
|
||||||
|
|
||||||
void out_of_memory(const char* where)
|
void out_of_memory(const char* where)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "out of memory in %s.\n", where);
|
||||||
|
|
||||||
|
if ( reporter )
|
||||||
|
// Guess that might fail here if memory is really tight ...
|
||||||
reporter->FatalError("out of memory in %s.\n", where);
|
reporter->FatalError("out of memory in %s.\n", where);
|
||||||
|
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_memory_usage(unsigned int* total, unsigned int* malloced)
|
void get_memory_usage(unsigned int* total, unsigned int* malloced)
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path metrics
|
#path metrics
|
||||||
|
#open 2012-07-20-01-50-41
|
||||||
#fields ts metric_id filter_name index.host index.str index.network value
|
#fields ts metric_id filter_name index.host index.str index.network value
|
||||||
#types time enum string addr string subnet count
|
#types time enum string addr string subnet count
|
||||||
1331256494.591966 TEST_METRIC foo-bar 6.5.4.3 - - 4
|
1342749041.601712 TEST_METRIC foo-bar 6.5.4.3 - - 4
|
||||||
1331256494.591966 TEST_METRIC foo-bar 7.2.1.5 - - 2
|
1342749041.601712 TEST_METRIC foo-bar 7.2.1.5 - - 2
|
||||||
1331256494.591966 TEST_METRIC foo-bar 1.2.3.4 - - 6
|
1342749041.601712 TEST_METRIC foo-bar 1.2.3.4 - - 6
|
||||||
|
#close 2012-07-20-01-50-49
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path test.failure
|
#path test.failure
|
||||||
|
#open 2012-07-20-01-50-18
|
||||||
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
||||||
#types time addr port addr port string string
|
#types time addr port addr port string string
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure US
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure US
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure UK
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure UK
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure MX
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure MX
|
||||||
|
#close 2012-07-20-01-50-18
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path test
|
#path test
|
||||||
|
#open 2012-07-20-01-50-18
|
||||||
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
||||||
#types time addr port addr port string string
|
#types time addr port addr port string string
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success unknown
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success unknown
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure US
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure US
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure UK
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure UK
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success BR
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success BR
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure MX
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure MX
|
||||||
|
#close 2012-07-20-01-50-18
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path test.success
|
#path test.success
|
||||||
|
#open 2012-07-20-01-50-18
|
||||||
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
||||||
#types time addr port addr port string string
|
#types time addr port addr port string string
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success unknown
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success unknown
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success BR
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success BR
|
||||||
|
#close 2012-07-20-01-50-18
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
ERROR: no such index (a[1]) (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter-error-in-handler/reporter-error-in-handler.bro, line 28)
|
error in /home/jsiwek/bro/testing/btest/.tmp/core.reporter-error-in-handler/reporter-error-in-handler.bro, line 22: no such index (a[2])
|
||||||
|
ERROR: no such index (a[1]) (/home/jsiwek/bro/testing/btest/.tmp/core.reporter-error-in-handler/reporter-error-in-handler.bro, line 28)
|
||||||
1st error printed on script level
|
1st error printed on script level
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
ERROR: no such index (a[2]) (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter-runtime-error/reporter-runtime-error.bro, line 9)
|
error in /home/jsiwek/bro/testing/btest/.tmp/core.reporter-runtime-error/reporter-runtime-error.bro, line 12: no such index (a[1])
|
||||||
|
ERROR: no such index (a[2]) (/home/jsiwek/bro/testing/btest/.tmp/core.reporter-runtime-error/reporter-runtime-error.bro, line 9)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
reporter_info|init test-info|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 8|0.000000
|
reporter_info|init test-info|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 8|0.000000
|
||||||
reporter_warning|init test-warning|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 9|0.000000
|
reporter_warning|init test-warning|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 9|0.000000
|
||||||
reporter_error|init test-error|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 10|0.000000
|
reporter_error|init test-error|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 10|0.000000
|
||||||
reporter_info|done test-info|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 15|0.000000
|
reporter_info|done test-info|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 15|0.000000
|
||||||
reporter_warning|done test-warning|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 16|0.000000
|
reporter_warning|done test-warning|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 16|0.000000
|
||||||
reporter_error|done test-error|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 17|0.000000
|
reporter_error|done test-error|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 17|0.000000
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
WARNING: init test-warning (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 9)
|
/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 52: pre test-info
|
||||||
ERROR: init test-error (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 10)
|
warning in /home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 53: pre test-warning
|
||||||
WARNING: done test-warning (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 16)
|
error in /home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 54: pre test-error
|
||||||
ERROR: done test-error (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 17)
|
WARNING: init test-warning (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 9)
|
||||||
|
ERROR: init test-error (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 10)
|
||||||
|
WARNING: done test-warning (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 16)
|
||||||
|
ERROR: done test-error (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 17)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
error: unknown writer type requested
|
|
@ -9,7 +9,7 @@
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 30
|
# @TEST-EXEC: btest-bg-wait 40
|
||||||
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -40,3 +40,24 @@ event bro_init() &priority=5
|
||||||
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
|
||||||
|
global n = 0;
|
||||||
|
|
||||||
|
event Metrics::log_metrics(rec: Metrics::Info)
|
||||||
|
{
|
||||||
|
n = n + 1;
|
||||||
|
if ( n == 3 )
|
||||||
|
{
|
||||||
|
terminate_communication();
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
#
|
#
|
||||||
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run sender HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m --pseudo-realtime %INPUT ../sender.bro
|
# @TEST-EXEC: btest-bg-run sender HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -b -m --pseudo-realtime %INPUT ../sender.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run receiver HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m --pseudo-realtime %INPUT ../receiver.bro
|
# @TEST-EXEC: btest-bg-run receiver HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -b -m --pseudo-realtime %INPUT ../receiver.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 30
|
||||||
# @TEST-EXEC: btest-diff sender/test.log
|
# @TEST-EXEC: btest-diff sender/test.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.failure.log
|
# @TEST-EXEC: btest-diff sender/test.failure.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.success.log
|
# @TEST-EXEC: btest-diff sender/test.success.log
|
||||||
# @TEST-EXEC: cmp receiver/test.log sender/test.log
|
# @TEST-EXEC: ( cd sender && for i in *.log; do cat $i | $SCRIPTS/diff-remove-timestamps >c.$i; done )
|
||||||
# @TEST-EXEC: cmp receiver/test.failure.log sender/test.failure.log
|
# @TEST-EXEC: ( cd receiver && for i in *.log; do cat $i | $SCRIPTS/diff-remove-timestamps >c.$i; done )
|
||||||
# @TEST-EXEC: cmp receiver/test.success.log sender/test.success.log
|
# @TEST-EXEC: cmp receiver/c.test.log sender/c.test.log
|
||||||
|
# @TEST-EXEC: cmp receiver/c.test.failure.log sender/c.test.failure.log
|
||||||
|
# @TEST-EXEC: cmp receiver/c.test.success.log sender/c.test.success.log
|
||||||
|
|
||||||
# This is the common part loaded by both sender and receiver.
|
# This is the common part loaded by both sender and receiver.
|
||||||
module Test;
|
module Test;
|
||||||
|
@ -43,10 +45,10 @@ event bro_init()
|
||||||
|
|
||||||
@TEST-START-FILE sender.bro
|
@TEST-START-FILE sender.bro
|
||||||
|
|
||||||
module Test;
|
|
||||||
|
|
||||||
@load frameworks/communication/listen
|
@load frameworks/communication/listen
|
||||||
|
|
||||||
|
module Test;
|
||||||
|
|
||||||
function fail(rec: Log): bool
|
function fail(rec: Log): bool
|
||||||
{
|
{
|
||||||
return rec$status != "success";
|
return rec$status != "success";
|
||||||
|
@ -68,14 +70,27 @@ event remote_connection_handshake_done(p: event_peer)
|
||||||
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
||||||
disconnect(p);
|
disconnect(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
@TEST-START-FILE receiver.bro
|
@TEST-START-FILE receiver.bro
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
@load base/frameworks/communication
|
||||||
|
|
||||||
redef Communication::nodes += {
|
redef Communication::nodes += {
|
||||||
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -10,4 +10,5 @@
|
||||||
# @TEST-EXEC: test -d $DIST/scripts
|
# @TEST-EXEC: test -d $DIST/scripts
|
||||||
# @TEST-EXEC: for script in `find $DIST/scripts -name \*\.bro -not -path '*/site/*'`; do echo $script; if echo "$script" | egrep -q 'communication/listen|controllee'; then rm -rf load_attempt .bgprocs; btest-bg-run load_attempt bro -b $script; btest-bg-wait -k 2; cat load_attempt/.stderr >>allerrors; else bro -b $script 2>>allerrors; fi done || exit 0
|
# @TEST-EXEC: for script in `find $DIST/scripts -name \*\.bro -not -path '*/site/*'`; do echo $script; if echo "$script" | egrep -q 'communication/listen|controllee'; then rm -rf load_attempt .bgprocs; btest-bg-run load_attempt bro -b $script; btest-bg-wait -k 2; cat load_attempt/.stderr >>allerrors; else bro -b $script 2>>allerrors; fi done || exit 0
|
||||||
# @TEST-EXEC: cat allerrors | grep -v "received termination signal" | sort | uniq > unique_errors
|
# @TEST-EXEC: cat allerrors | grep -v "received termination signal" | sort | uniq > unique_errors
|
||||||
# @TEST-EXEC: btest-diff unique_errors
|
# @TEST-EXEC: if [ $(grep -c CURL_INCLUDE_DIR-NOTFOUND $BUILD/CMakeCache.txt) -ne 0 ]; then cp unique_errors unique_errors_no_elasticsearch; fi
|
||||||
|
# @TEST-EXEC: if [ $(grep -c CURL_INCLUDE_DIR-NOTFOUND $BUILD/CMakeCache.txt) -ne 0 ]; then btest-diff unique_errors_no_elasticsearch; else btest-diff unique_errors; fi
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# @TEST-SERIALIZE: comm
|
# @TEST-SERIALIZE: comm
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run sender bro --pseudo-realtime %INPUT ../sender.bro
|
# @TEST-EXEC: btest-bg-run sender bro -b --pseudo-realtime %INPUT ../sender.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run receiver bro --pseudo-realtime %INPUT ../receiver.bro
|
# @TEST-EXEC: btest-bg-run receiver bro -b --pseudo-realtime %INPUT ../receiver.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 15
|
||||||
# @TEST-EXEC: btest-diff sender/test.log
|
# @TEST-EXEC: btest-diff sender/test.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.failure.log
|
# @TEST-EXEC: btest-diff sender/test.failure.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.success.log
|
# @TEST-EXEC: btest-diff sender/test.success.log
|
||||||
|
@ -41,10 +41,10 @@ event bro_init()
|
||||||
|
|
||||||
@TEST-START-FILE sender.bro
|
@TEST-START-FILE sender.bro
|
||||||
|
|
||||||
module Test;
|
|
||||||
|
|
||||||
@load frameworks/communication/listen
|
@load frameworks/communication/listen
|
||||||
|
|
||||||
|
module Test;
|
||||||
|
|
||||||
function fail(rec: Log): bool
|
function fail(rec: Log): bool
|
||||||
{
|
{
|
||||||
return rec$status != "success";
|
return rec$status != "success";
|
||||||
|
@ -66,14 +66,27 @@ event remote_connection_handshake_done(p: event_peer)
|
||||||
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
||||||
disconnect(p);
|
disconnect(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
@TEST-START-FILE receiver.bro
|
@TEST-START-FILE receiver.bro
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
@load base/frameworks/communication
|
||||||
|
|
||||||
redef Communication::nodes += {
|
redef Communication::nodes += {
|
||||||
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: bro -b -r ${TRACES}/rotation.trace %INPUT | egrep "test|test2" | sort >out.tmp
|
# @TEST-EXEC: bro -b -r ${TRACES}/rotation.trace %INPUT | egrep "test|test2" | sort >out.tmp
|
||||||
# @TEST-EXEC: cat out.tmp pp.log | sort >out
|
# @TEST-EXEC: cat out.tmp pp.log | sort >out
|
||||||
# @TEST-EXEC: for i in `ls test*.log | sort`; do printf '> %s\n' $i; cat $i; done | sort | uniq >>out
|
# @TEST-EXEC: for i in `ls test*.log | sort`; do printf '> %s\n' $i; cat $i; done | sort | $SCRIPTS/diff-remove-timestamps | uniq >>out
|
||||||
# @TEST-EXEC: btest-diff out
|
# @TEST-EXEC: btest-diff out
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff .stderr
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff .stderr
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 20
|
||||||
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -36,3 +36,24 @@ event bro_init() &priority=5
|
||||||
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
|
||||||
|
global n = 0;
|
||||||
|
|
||||||
|
event Metrics::log_metrics(rec: Metrics::Info)
|
||||||
|
{
|
||||||
|
n = n + 1;
|
||||||
|
if ( n == 3 )
|
||||||
|
{
|
||||||
|
terminate_communication();
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 20
|
||||||
# @TEST-EXEC: btest-diff manager-1/notice.log
|
# @TEST-EXEC: btest-diff manager-1/notice.log
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -37,6 +37,21 @@ event bro_init() &priority=5
|
||||||
$log=T]);
|
$log=T]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
|
||||||
|
event Notice::log_notice(rec: Notice::Info)
|
||||||
|
{
|
||||||
|
terminate_communication();
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||||
|
|
||||||
event do_metrics(i: count)
|
event do_metrics(i: count)
|
||||||
|
|
|
@ -3,20 +3,27 @@
|
||||||
# A diff canonifier that removes all MIME types because libmagic output
|
# A diff canonifier that removes all MIME types because libmagic output
|
||||||
# can differ between installations.
|
# can differ between installations.
|
||||||
|
|
||||||
BEGIN { FS="\t"; OFS="\t"; column = -1; }
|
BEGIN { FS="\t"; OFS="\t"; type_col = -1; desc_col = -1 }
|
||||||
|
|
||||||
/^#fields/ {
|
/^#fields/ {
|
||||||
for ( i = 2; i < NF; ++i )
|
for ( i = 2; i < NF; ++i )
|
||||||
|
{
|
||||||
if ( $i == "mime_type" )
|
if ( $i == "mime_type" )
|
||||||
column = i-1;
|
type_col = i-1;
|
||||||
|
if ( $i == "mime_desc" )
|
||||||
|
desc_col = i-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
column >= 0 {
|
function remove_mime (n) {
|
||||||
if ( $column != "-" )
|
if ( n >= 0 && $n != "-" )
|
||||||
# Mark that it's set, but ignore content.
|
# Mark that it's set, but ignore content.
|
||||||
$column = "+";
|
$n = "+"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_mime(type_col)
|
||||||
|
remove_mime(desc_col)
|
||||||
|
|
||||||
{
|
{
|
||||||
print;
|
print;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue