mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
Rotation support.
This follows rather closely how rotation currently works in rotate-logs.bro. logging.bro now defines: # Default rotation interval; zero disables rotation. const default_rotation_interval = 0secs &redef; # Default naming suffix format. const default_rotation_date_format = "%y-%m-%d_%H.%M.%S" &redef; # Default postprocessor for writers outputting into files. const default_rotation_postprocessor = "" &redef; # Default function to construct the name of the rotated file. # The default implementation includes # default_rotation_date_format into the file name. global default_rotation_path_func: function(info: RotationInfo) : string &redef; Writer support for rotation is optional, usually it will only make sense for file-based writers. TODO: Currently, there's no way to customize rotation on a per file basis, there are only the global defaults as described above. Individual customization is coming next.
This commit is contained in:
parent
90af0d06c3
commit
d6cef16f77
16 changed files with 387 additions and 68 deletions
18
src/parse.y
18
src/parse.y
|
@ -42,7 +42,7 @@
|
|||
%left '$' '[' ']' '(' ')' TOK_HAS_FIELD TOK_HAS_ATTR
|
||||
|
||||
%type <str> TOK_ID TOK_PATTERN_TEXT single_pattern
|
||||
%type <id> local_id global_id event_id global_or_event_id resolve_id begin_func
|
||||
%type <id> local_id global_id def_global_id event_id global_or_event_id resolve_id begin_func
|
||||
%type <id_l> local_id_list
|
||||
%type <ic> init_class
|
||||
%type <expr> opt_init
|
||||
|
@ -102,6 +102,7 @@ Expr* bro_this = 0;
|
|||
int in_init = 0;
|
||||
bool in_debug = false;
|
||||
bool resolving_global_ID = false;
|
||||
bool defining_global_ID = false;
|
||||
|
||||
ID* func_id = 0;
|
||||
EnumType *cur_enum_type = 0;
|
||||
|
@ -842,10 +843,10 @@ decl:
|
|||
| TOK_EXPORT '{' { is_export = true; } decl_list '}'
|
||||
{ is_export = false; }
|
||||
|
||||
| TOK_GLOBAL global_id opt_type init_class opt_init opt_attr ';'
|
||||
| TOK_GLOBAL def_global_id opt_type init_class opt_init opt_attr ';'
|
||||
{ add_global($2, $3, $4, $5, $6, VAR_REGULAR); }
|
||||
|
||||
| TOK_CONST global_id opt_type init_class opt_init opt_attr ';'
|
||||
| TOK_CONST def_global_id opt_type init_class opt_init opt_attr ';'
|
||||
{ add_global($2, $3, $4, $5, $6, VAR_CONST); }
|
||||
|
||||
| TOK_REDEF global_id opt_type init_class opt_init opt_attr ';'
|
||||
|
@ -855,7 +856,7 @@ decl:
|
|||
'{' { parser_redef_enum($3); } enum_body '}' ';'
|
||||
{ /* no action */ }
|
||||
|
||||
| TOK_TYPE global_id ':' refined_type opt_attr ';'
|
||||
| TOK_TYPE def_global_id ':' refined_type opt_attr ';'
|
||||
{
|
||||
add_type($2, $4, $5, 0);
|
||||
}
|
||||
|
@ -883,7 +884,7 @@ conditional:
|
|||
;
|
||||
|
||||
func_hdr:
|
||||
TOK_FUNCTION global_id func_params
|
||||
TOK_FUNCTION def_global_id func_params
|
||||
{
|
||||
begin_func($2, current_module.c_str(),
|
||||
FUNC_FLAVOR_FUNCTION, 0, $3);
|
||||
|
@ -1265,6 +1266,11 @@ global_id:
|
|||
{ $$ = $2; }
|
||||
;
|
||||
|
||||
def_global_id:
|
||||
{ defining_global_ID = 1; } global_id { defining_global_ID = 0; }
|
||||
{ $$ = $2; }
|
||||
;
|
||||
|
||||
event_id:
|
||||
{ resolving_global_ID = 0; } global_or_event_id
|
||||
{ $$ = $2; }
|
||||
|
@ -1275,7 +1281,7 @@ global_or_event_id:
|
|||
{
|
||||
set_location(@1);
|
||||
|
||||
$$ = lookup_ID($1, current_module.c_str(), false);
|
||||
$$ = lookup_ID($1, current_module.c_str(), false, defining_global_ID);
|
||||
if ( $$ )
|
||||
{
|
||||
if ( ! $$->IsGlobal() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue