mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Allow Print Statements to be redirected to a Log# This is a combination of 3 commits.
This commit is contained in:
parent
75588956fc
commit
c9016f1397
5 changed files with 89 additions and 0 deletions
|
@ -75,6 +75,23 @@ export {
|
|||
## Returns: The path to be used for the filter.
|
||||
global default_path_func: function(id: ID, path: string, rec: any) : string &redef;
|
||||
|
||||
# Log Print Statements
|
||||
|
||||
type PrintLogInfo: record {
|
||||
## Current timestamp.
|
||||
ts: time &log;
|
||||
## Set of strings passed to the print statement.
|
||||
vals: set[string] &log;
|
||||
};
|
||||
|
||||
redef enum Log::ID += {PRINTLOG};
|
||||
|
||||
## If true, logging is enabled for print statements instead of output to files
|
||||
const print_to_log = F &redef;
|
||||
|
||||
## If print_to_log is true, this is the path to which the print Log Stream writes
|
||||
const print_log_path = "print" &redef;
|
||||
|
||||
# Log rotation support.
|
||||
|
||||
## Information passed into rotation callback functions.
|
||||
|
@ -643,3 +660,10 @@ function remove_default_filter(id: ID) : bool
|
|||
{
|
||||
return remove_filter(id, "default");
|
||||
}
|
||||
|
||||
event zeek_init() &priority=5
|
||||
{
|
||||
if ( print_to_log )
|
||||
# "print" added for the test coverage.find-bro-logs
|
||||
Log::create_stream(PRINTLOG, [$columns=PrintLogInfo, $path=print_log_path]); #"print"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue