73
74
gchar __buf[256]; \
74
75
g_snprintf(__buf, sizeof(__buf), errorfmt ? errorfmt : "x", ## __VA_ARGS__); \
75
yyerror(& (token), lexer, NULL, __buf); \
76
yyerror(& (token), lexer, NULL, NULL, __buf); \
436
/* LogSource related options */
438
/* NOTE: plugins need to set "last_source_options" in order to incorporate this rule in their grammar */
439
: KW_LOG_IW_SIZE '(' LL_NUMBER ')' { last_source_options->init_window_size = $3; }
440
| KW_CHAIN_HOSTNAMES '(' yesno ')' { last_source_options->chain_hostnames = $3; }
441
| KW_NORMALIZE_HOSTNAMES '(' yesno ')' { last_source_options->normalize_hostnames = $3; }
442
| KW_KEEP_HOSTNAME '(' yesno ')' { last_source_options->keep_hostname = $3; }
443
| KW_USE_FQDN '(' yesno ')' { last_source_options->use_fqdn = $3; }
444
| KW_USE_DNS '(' dnsmode ')' { last_source_options->use_dns = $3; }
445
| KW_DNS_CACHE '(' yesno ')' { last_source_options->use_dns_cache = $3; }
446
| KW_PROGRAM_OVERRIDE '(' string ')' { last_source_options->program_override = g_strdup($3); free($3); }
447
| KW_HOST_OVERRIDE '(' string ')' { last_source_options->host_override = g_strdup($3); free($3); }
448
| KW_LOG_PREFIX '(' string ')' { gchar *p = strrchr($3, ':'); if (p) *p = 0; last_source_options->program_override = g_strdup($3); free($3); }
449
| KW_KEEP_TIMESTAMP '(' yesno ')' { last_source_options->keep_timestamp = $3; }
450
| KW_TAGS '(' string_list ')' { log_source_options_set_tags(last_source_options, $3); }
423
454
source_reader_options
424
455
: source_reader_option source_reader_options
459
/* LogReader related options, inherits from LogSource */
428
460
source_reader_option
429
: KW_LOG_IW_SIZE '(' LL_NUMBER ')' { last_reader_options->super.init_window_size = $3; }
430
| KW_CHAIN_HOSTNAMES '(' yesno ')' { last_reader_options->super.chain_hostnames = $3; }
431
| KW_NORMALIZE_HOSTNAMES '(' yesno ')' { last_reader_options->super.normalize_hostnames = $3; }
432
| KW_KEEP_HOSTNAME '(' yesno ')' { last_reader_options->super.keep_hostname = $3; }
433
| KW_USE_FQDN '(' yesno ')' { last_reader_options->super.use_fqdn = $3; }
434
| KW_USE_DNS '(' dnsmode ')' { last_reader_options->super.use_dns = $3; }
435
| KW_DNS_CACHE '(' yesno ')' { last_reader_options->super.use_dns_cache = $3; }
436
| KW_PROGRAM_OVERRIDE '(' string ')' { last_reader_options->super.program_override = g_strdup($3); free($3); }
437
| KW_HOST_OVERRIDE '(' string ')' { last_reader_options->super.host_override = g_strdup($3); free($3); }
438
| KW_LOG_PREFIX '(' string ')' { gchar *p = strrchr($3, ':'); if (p) *p = 0; last_reader_options->super.program_override = g_strdup($3); free($3); }
439
| KW_TIME_ZONE '(' string ')' { last_reader_options->parse_options.recv_time_zone = g_strdup($3); free($3); }
461
/* NOTE: plugins need to set "last_reader_options" in order to incorporate this rule in their grammar */
463
: KW_TIME_ZONE '(' string ')' { last_reader_options->parse_options.recv_time_zone = g_strdup($3); free($3); }
440
464
| KW_CHECK_HOSTNAME '(' yesno ')' { last_reader_options->check_hostname = $3; }
441
465
| KW_FLAGS '(' source_reader_option_flags ')'
442
466
| KW_LOG_MSG_SIZE '(' LL_NUMBER ')' { last_reader_options->msg_size = $3; }
443
467
| KW_LOG_FETCH_LIMIT '(' LL_NUMBER ')' { last_reader_options->fetch_limit = $3; }
444
468
| KW_PAD_SIZE '(' LL_NUMBER ')' { last_reader_options->padding = $3; }
445
| KW_KEEP_TIMESTAMP '(' yesno ')' { last_reader_options->super.keep_timestamp = $3; }
446
469
| KW_ENCODING '(' string ')' { last_reader_options->text_encoding = g_strdup($3); free($3); }
447
| KW_TAGS '(' string_list ')' { log_reader_options_set_tags(last_reader_options, $3); }
448
470
| KW_FORMAT '(' string ')' { last_reader_options->parse_options.format = g_strdup($3); free($3); }
449
471
| KW_DEFAULT_LEVEL '(' level_string ')'
458
480
last_reader_options->parse_options.default_pri = LOG_NOTICE;
459
481
last_reader_options->parse_options.default_pri = (last_reader_options->parse_options.default_pri & 7) | $3;
483
| { last_source_options = &last_reader_options->super; } source_option
463
486
source_reader_option_flags
464
487
: string source_reader_option_flags { CHECK_ERROR(log_reader_options_process_flag(last_reader_options, $1), @1, "Unknown flag %s", $1); free($1); }
488
| KW_CHECK_HOSTNAME source_reader_option_flags { log_reader_options_process_flag(last_reader_options, "check-hostname"); }
493
/* NOTE: plugins need to set "last_driver" in order to incorporate this rule in their grammar */
495
: KW_LOG_FIFO_SIZE '(' LL_NUMBER ')' { ((LogDestDriver *) last_driver)->log_fifo_size = $3; }
496
| KW_THROTTLE '(' LL_NUMBER ')' { ((LogDestDriver *) last_driver)->throttle = $3; }
500
gint context = LL_CONTEXT_INNER_DEST;
503
p = plugin_find(configuration, context, $1);
504
CHECK_ERROR(p, @1, "%s plugin %s not found", cfg_lexer_lookup_context_name_by_type(context), $1);
506
value = plugin_parse_config(p, configuration, &@1, last_driver);
513
log_driver_add_plugin(last_driver, (LogDriverPlugin *) value);
468
517
dest_writer_options
469
518
: dest_writer_option dest_writer_options
473
522
dest_writer_option
523
/* NOTE: plugins need to set "last_writer_options" in order to incorporate this rule in their grammar */
474
525
: KW_FLAGS '(' dest_writer_options_flags ')' { last_writer_options->options = $3; }
475
| KW_LOG_FIFO_SIZE '(' LL_NUMBER ')' { last_writer_options->mem_fifo_size = $3; }
476
526
| KW_FLUSH_LINES '(' LL_NUMBER ')' { last_writer_options->flush_lines = $3; }
477
527
| KW_FLUSH_TIMEOUT '(' LL_NUMBER ')' { last_writer_options->flush_timeout = $3; }
478
528
| KW_SUPPRESS '(' LL_NUMBER ')' { last_writer_options->suppress = $3; }
479
529
| KW_TEMPLATE '(' string ')' {
480
530
GError *error = NULL;
482
last_writer_options->template = cfg_check_inline_template(configuration, $3);
483
CHECK_ERROR(log_template_compile(last_writer_options->template, &error), @3, "Error compiling template (%s)", error->message);
532
last_writer_options->template = cfg_check_inline_template(configuration, $3, &error);
533
CHECK_ERROR(last_writer_options->template != NULL, @3, "Error compiling template (%s)", error->message);
486
536
| KW_TEMPLATE_ESCAPE '(' yesno ')' { log_writer_options_set_template_escape(last_writer_options, $3); }
487
537
| KW_TIME_ZONE '(' string ')' { last_writer_options->template_options.time_zone[LTZ_SEND] = g_strdup($3); free($3); }
488
538
| KW_TS_FORMAT '(' string ')' { last_writer_options->template_options.ts_format = cfg_ts_format_value($3); free($3); }
489
539
| KW_FRAC_DIGITS '(' LL_NUMBER ')' { last_writer_options->template_options.frac_digits = $3; }
490
| KW_THROTTLE '(' LL_NUMBER ')' { last_writer_options->throttle = $3; }
540
| KW_PAD_SIZE '(' LL_NUMBER ')' { last_writer_options->padding = $3; }
493
543
dest_writer_options_flags
550
{ last_value_pairs = value_pairs_new(); }
552
{ $$ = last_value_pairs; }
556
: vp_option vp_options
561
: KW_PAIR '(' string ':' string ')' { value_pairs_add_pair(last_value_pairs, configuration, $3, $5); free($3); free($5); }
562
| KW_PAIR '(' string string ')' { value_pairs_add_pair(last_value_pairs, configuration, $3, $4); free($3); free($4); }
563
| KW_KEY '(' string ')' {
564
gchar *k = g_strconcat("$", $3, NULL);
565
value_pairs_add_pair(last_value_pairs, configuration, $3, k);
569
| KW_EXCLUDE '(' string ')' { value_pairs_add_exclude_glob(last_value_pairs, $3); free($3); }
570
| KW_SCOPE '(' vp_scope_list ')'
574
: string vp_scope_list { value_pairs_add_scope(last_value_pairs, $1); free($1); }