mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
make raw reading work.
apparently there was a crash in the reader plugin, but main bro did not notice but waited for eternity for it do to something.
This commit is contained in:
parent
57ffe1be77
commit
367c4b4a7e
3 changed files with 17 additions and 19 deletions
|
@ -220,11 +220,8 @@ bool Manager::CreateStream(Filter* info, RecordVal* description)
|
|||
info->name = name;
|
||||
info->source = source;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
DBG_LOG(DBG_INPUT, "Successfully created new input stream %s",
|
||||
name.c_str());
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -334,6 +331,10 @@ bool Manager::CreateEventStream(RecordVal* fval) {
|
|||
filter->reader->Init(filter->source, filter->mode, filter->num_fields, logf );
|
||||
|
||||
readers[filter->reader] = filter;
|
||||
|
||||
DBG_LOG(DBG_INPUT, "Successfully created event stream %s",
|
||||
filter->name.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -483,11 +484,8 @@ bool Manager::CreateTableStream(RecordVal* fval) {
|
|||
|
||||
readers[filter->reader] = filter;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
DBG_LOG(DBG_INPUT, "Successfully created table stream %s",
|
||||
filter->name.c_str());
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ bool Raw::DoInit(string path, int arg_mode, int arg_num_fields, const Field* con
|
|||
return false;
|
||||
}
|
||||
|
||||
num_fields = arg_num_fields;
|
||||
fields = arg_fields;
|
||||
|
||||
if ( arg_num_fields != 1 ) {
|
||||
Error("Filter for raw reader contains more than one field. Filters for the raw reader may only contain exactly one string field. Filter ignored.");
|
||||
return false;
|
||||
|
@ -74,8 +77,9 @@ bool Raw::DoInit(string path, int arg_mode, int arg_num_fields, const Field* con
|
|||
return false;
|
||||
}
|
||||
|
||||
num_fields = arg_num_fields;
|
||||
fields = arg_fields;
|
||||
#ifdef DEBUG
|
||||
Debug(DBG_INPUT, "Raw reader created, will perform first update");
|
||||
#endif
|
||||
|
||||
switch ( mode ) {
|
||||
case MANUAL:
|
||||
|
@ -87,6 +91,7 @@ bool Raw::DoInit(string path, int arg_mode, int arg_num_fields, const Field* con
|
|||
assert(false);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# @TEST-EXEC: bro %INPUT >out
|
||||
# @TEST-EXEC: bro -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
@TEST-START-FILE input.log
|
||||
|
@ -16,10 +16,6 @@ sdf
|
|||
|
||||
module A;
|
||||
|
||||
export {
|
||||
redef enum Input::ID += { INPUT };
|
||||
}
|
||||
|
||||
type Val: record {
|
||||
s: string;
|
||||
};
|
||||
|
@ -30,6 +26,5 @@ event line(tpe: Input::Event, s: string) {
|
|||
|
||||
event bro_init()
|
||||
{
|
||||
Input::create_stream(A::INPUT, [$source="input.log", $reader=Input::READER_RAW, $mode=Input::STREAM]);
|
||||
Input::add_eventfilter(A::INPUT, [$name="input", $fields=Val, $ev=line]);
|
||||
Input::add_event([$source="input.log", $reader=Input::READER_RAW, $mode=Input::STREAM, $name="input", $fields=Val, $ev=line]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue