mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00

This introduces the following redefinable string constants, empty by default: - InputAscii::path_prefix - InputBinary::path_prefix - Intel::path_prefix When using ASCII or binary reades in the Input/Intel Framework with an input stream source that does not have an absolute path, these constants cause Zeek to prefix the resulting paths accordingly. For example, in the following the location on disk from which Zeek loads the input becomes "/path/to/input/whitelist.data": redef InputAscii::path_prefix = "/path/to/input"; event bro_init() { Input::add_table([$source="whitelist.data", ...]); } These path prefixes can be absolute or relative. When an input stream source already uses an absolute path, this path is preserved and the new variables have no effect (i.e., we do not affect configurations already using absolute paths). Since the Intel framework builds upon the Input framework, the first two paths also affect Intel file locations. If this is undesirable, the Intel::path_prefix variable allows specifying a separate path: when its value is absolute, the resulting source seen by the Input framework is absolute, therefore no further changes to the paths happen.
56 lines
2.2 KiB
Text
56 lines
2.2 KiB
Text
##! Interface for the ascii input reader.
|
|
##!
|
|
##! The defaults are set to match Bro's ASCII output.
|
|
|
|
module InputAscii;
|
|
|
|
export {
|
|
## Separator between fields.
|
|
## Please note that the separator has to be exactly one character long.
|
|
const separator = Input::separator &redef;
|
|
|
|
## Separator between set and vector elements.
|
|
## Please note that the separator has to be exactly one character long.
|
|
const set_separator = Input::set_separator &redef;
|
|
|
|
## String to use for empty fields.
|
|
const empty_field = Input::empty_field &redef;
|
|
|
|
## String to use for an unset &optional field.
|
|
const unset_field = Input::unset_field &redef;
|
|
|
|
## Fail on invalid lines. If set to false, the ascii
|
|
## input reader will jump over invalid lines, reporting
|
|
## warnings in reporter.log. If set to true, errors in
|
|
## input lines will be handled as fatal errors for the
|
|
## reader thread; reading will abort immediately and
|
|
## an error will be logged to reporter.log.
|
|
## Individual readers can use a different value using
|
|
## the $config table.
|
|
## fail_on_invalid_lines = T was the default behavior
|
|
## until Bro 2.6.
|
|
const fail_on_invalid_lines = F &redef;
|
|
|
|
## Fail on file read problems. If set to true, the ascii
|
|
## input reader will fail when encountering any problems
|
|
## while reading a file different from invalid lines.
|
|
## Examples of such problems are permission problems, or
|
|
## missing files.
|
|
## When set to false, these problems will be ignored. This
|
|
## has an especially big effect for the REREAD mode, which will
|
|
## seamlessly recover from read errors when a file is
|
|
## only temporarily inaccessible. For MANUAL or STREAM files,
|
|
## errors will most likely still be fatal since no automatic
|
|
## re-reading of the file is attempted.
|
|
## Individual readers can use a different value using
|
|
## the $config table.
|
|
## fail_on_file_problem = T was the default behavior
|
|
## until Bro 2.6.
|
|
const fail_on_file_problem = F &redef;
|
|
|
|
## On input streams with a pathless or relative-path source filename,
|
|
## prefix the following path. This prefix can, but need not be, absolute.
|
|
## The default is to leave any filenames unchanged. This prefix has no
|
|
## effect if the source already is an absolute path.
|
|
const path_prefix = "" &redef;
|
|
}
|