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); \
369
/* LogSource related options */
371
/* NOTE: plugins need to set "last_source_options" in order to incorporate this rule in their grammar */
372
: KW_LOG_IW_SIZE '(' LL_NUMBER ')' { last_source_options->init_window_size = $3; }
373
| KW_CHAIN_HOSTNAMES '(' yesno ')' { last_source_options->chain_hostnames = $3; }
374
| KW_NORMALIZE_HOSTNAMES '(' yesno ')' { last_source_options->normalize_hostnames = $3; }
375
| KW_KEEP_HOSTNAME '(' yesno ')' { last_source_options->keep_hostname = $3; }
376
| KW_USE_FQDN '(' yesno ')' { last_source_options->use_fqdn = $3; }
377
| KW_USE_DNS '(' dnsmode ')' { last_source_options->use_dns = $3; }
378
| KW_DNS_CACHE '(' yesno ')' { last_source_options->use_dns_cache = $3; }
379
| KW_PROGRAM_OVERRIDE '(' string ')' { last_source_options->program_override = g_strdup($3); free($3); }
380
| KW_HOST_OVERRIDE '(' string ')' { last_source_options->host_override = g_strdup($3); free($3); }
381
| KW_LOG_PREFIX '(' string ')' { gchar *p = strrchr($3, ':'); if (p) *p = 0; last_source_options->program_override = g_strdup($3); free($3); }
382
| KW_KEEP_TIMESTAMP '(' yesno ')' { last_source_options->keep_timestamp = $3; }
383
| KW_TAGS '(' string_list ')' { log_source_options_set_tags(last_source_options, $3); }
356
387
source_reader_options
357
388
: source_reader_option source_reader_options
392
/* LogReader related options, inherits from LogSource */
361
393
source_reader_option
362
: KW_LOG_IW_SIZE '(' LL_NUMBER ')' { last_reader_options->super.init_window_size = $3; }
363
| KW_CHAIN_HOSTNAMES '(' yesno ')' { last_reader_options->super.chain_hostnames = $3; }
364
| KW_NORMALIZE_HOSTNAMES '(' yesno ')' { last_reader_options->super.normalize_hostnames = $3; }
365
| KW_KEEP_HOSTNAME '(' yesno ')' { last_reader_options->super.keep_hostname = $3; }
366
| KW_USE_FQDN '(' yesno ')' { last_reader_options->super.use_fqdn = $3; }
367
| KW_USE_DNS '(' dnsmode ')' { last_reader_options->super.use_dns = $3; }
368
| KW_DNS_CACHE '(' yesno ')' { last_reader_options->super.use_dns_cache = $3; }
369
| KW_PROGRAM_OVERRIDE '(' string ')' { last_reader_options->super.program_override = g_strdup($3); free($3); }
370
| KW_HOST_OVERRIDE '(' string ')' { last_reader_options->super.host_override = g_strdup($3); free($3); }
371
| KW_LOG_PREFIX '(' string ')' { gchar *p = strrchr($3, ':'); if (p) *p = 0; last_reader_options->super.program_override = g_strdup($3); free($3); }
372
| KW_TIME_ZONE '(' string ')' { last_reader_options->parse_options.recv_time_zone = g_strdup($3); free($3); }
394
/* NOTE: plugins need to set "last_reader_options" in order to incorporate this rule in their grammar */
396
: KW_TIME_ZONE '(' string ')' { last_reader_options->parse_options.recv_time_zone = g_strdup($3); free($3); }
373
397
| KW_CHECK_HOSTNAME '(' yesno ')' { last_reader_options->check_hostname = $3; }
374
398
| KW_FLAGS '(' source_reader_option_flags ')'
375
399
| KW_LOG_MSG_SIZE '(' LL_NUMBER ')' { last_reader_options->msg_size = $3; }
376
400
| KW_LOG_FETCH_LIMIT '(' LL_NUMBER ')' { last_reader_options->fetch_limit = $3; }
377
401
| KW_PAD_SIZE '(' LL_NUMBER ')' { last_reader_options->padding = $3; }
378
| KW_KEEP_TIMESTAMP '(' yesno ')' { last_reader_options->super.keep_timestamp = $3; }
379
402
| KW_ENCODING '(' string ')' { last_reader_options->text_encoding = g_strdup($3); free($3); }
380
| KW_TAGS '(' string_list ')' { log_reader_options_set_tags(last_reader_options, $3); }
381
403
| KW_FORMAT '(' string ')' { last_reader_options->parse_options.format = g_strdup($3); free($3); }
382
404
| KW_DEFAULT_LEVEL '(' level_string ')'
391
413
last_reader_options->parse_options.default_pri = LOG_NOTICE;
392
414
last_reader_options->parse_options.default_pri = (last_reader_options->parse_options.default_pri & 7) | $3;
416
| { last_source_options = &last_reader_options->super; } source_option
396
419
source_reader_option_flags
397
420
: string source_reader_option_flags { CHECK_ERROR(log_reader_options_process_flag(last_reader_options, $1), @1, "Unknown flag %s", $1); free($1); }
421
| KW_CHECK_HOSTNAME source_reader_option_flags { log_reader_options_process_flag(last_reader_options, "check-hostname"); }
426
/* NOTE: plugins need to set "last_driver" in order to incorporate this rule in their grammar */
428
: KW_LOG_FIFO_SIZE '(' LL_NUMBER ')' { ((LogDestDriver *) last_driver)->log_fifo_size = $3; }
429
| KW_THROTTLE '(' LL_NUMBER ')' { ((LogDestDriver *) last_driver)->throttle = $3; }
433
gint context = LL_CONTEXT_INNER_DEST;
436
p = plugin_find(configuration, context, $1);
437
CHECK_ERROR(p, @1, "%s plugin %s not found", cfg_lexer_lookup_context_name_by_type(context), $1);
439
value = plugin_parse_config(p, configuration, &@1, last_driver);
446
log_driver_add_plugin(last_driver, (LogDriverPlugin *) value);
401
450
dest_writer_options
402
451
: dest_writer_option dest_writer_options
406
455
dest_writer_option
456
/* NOTE: plugins need to set "last_writer_options" in order to incorporate this rule in their grammar */
407
458
: KW_FLAGS '(' dest_writer_options_flags ')' { last_writer_options->options = $3; }
408
| KW_LOG_FIFO_SIZE '(' LL_NUMBER ')' { last_writer_options->mem_fifo_size = $3; }
409
459
| KW_FLUSH_LINES '(' LL_NUMBER ')' { last_writer_options->flush_lines = $3; }
410
460
| KW_FLUSH_TIMEOUT '(' LL_NUMBER ')' { last_writer_options->flush_timeout = $3; }
411
461
| KW_SUPPRESS '(' LL_NUMBER ')' { last_writer_options->suppress = $3; }
412
462
| KW_TEMPLATE '(' string ')' {
413
463
GError *error = NULL;
415
last_writer_options->template = cfg_check_inline_template(configuration, $3);
416
CHECK_ERROR(log_template_compile(last_writer_options->template, &error), @3, "Error compiling template (%s)", error->message);
465
last_writer_options->template = cfg_check_inline_template(configuration, $3, &error);
466
CHECK_ERROR(last_writer_options->template != NULL, @3, "Error compiling template (%s)", error->message);
419
469
| KW_TEMPLATE_ESCAPE '(' yesno ')' { log_writer_options_set_template_escape(last_writer_options, $3); }
420
470
| KW_TIME_ZONE '(' string ')' { last_writer_options->template_options.time_zone[LTZ_SEND] = g_strdup($3); free($3); }
421
471
| KW_TS_FORMAT '(' string ')' { last_writer_options->template_options.ts_format = cfg_ts_format_value($3); free($3); }
422
472
| KW_FRAC_DIGITS '(' LL_NUMBER ')' { last_writer_options->template_options.frac_digits = $3; }
423
| KW_THROTTLE '(' LL_NUMBER ')' { last_writer_options->throttle = $3; }
473
| KW_PAD_SIZE '(' LL_NUMBER ')' { last_writer_options->padding = $3; }
426
476
dest_writer_options_flags
483
{ last_value_pairs = value_pairs_new(); }
485
{ $$ = last_value_pairs; }
489
: vp_option vp_options
494
: KW_PAIR '(' string ':' string ')' { value_pairs_add_pair(last_value_pairs, configuration, $3, $5); free($3); free($5); }
495
| KW_PAIR '(' string string ')' { value_pairs_add_pair(last_value_pairs, configuration, $3, $4); free($3); free($4); }
496
| KW_KEY '(' string ')' {
497
gchar *k = g_strconcat("$", $3, NULL);
498
value_pairs_add_pair(last_value_pairs, configuration, $3, k);
502
| KW_EXCLUDE '(' string ')' { value_pairs_add_exclude_glob(last_value_pairs, $3); free($3); }
503
| KW_SCOPE '(' vp_scope_list ')'
507
: string vp_scope_list { value_pairs_add_scope(last_value_pairs, $1); free($1); }