~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/pragma-grammar.y

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS), Gergely Nagy
  • Date: 2011-10-11 14:30:48 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20111011143048-r1iljux9xbvj3lwh
Tags: 3.3.1.dfsg-1
* New upstream release with important fixes from upstream git tree with
  non-free manpages removed.
* Drop syslog-ng.conf(5) (closes: #496521).
* syslog-ng(8) is generated, and does not mention -Q anymore
  (closes: #616069).
* Supports CAP_SYSLOG on recent kernels (closes: #630172).
* Does not use g_timeout_add_seconds anymore (closes: #609154).

[ Gergely Nagy <algernon@madhouse-project.org> ]
* Update debian/copyright to DEP-5 format.
* Simplified the logrotate file by merging identical entries.
* Include local configuration files from /etc/syslog-ng/conf.d/ (Closes:
  #609050).
* Update syslog-ng.conf to be fully 3.3 compliant.
* Compress both source and binaries (except the syslog-ng meta
  package) with xz, instead of gzip.
* Use dpkg triggers to restart syslog-ng when appropriate.
* Include DFSG-free manual pages for all binaries.
* Build with Hardening enabled.
* Mention syslog(3) in /etc/default/syslog-ng, instead of
  <linux/kernel.h> (Closes: #608605)
* Support 'status' in the init script.
  Patch from Peter Eisentraut <petere@debian.org> (Closes: #644458)
* Build-Depend on libevtlog-dev (>= 0.2.12-5~) for correct shlibs.
* Use [linux-any] in Build-Depends instead of hardcoded links.
  (Closes: #634715)
* Use $SYSLOGNG_OPTS in the init script when reloading syslog-ng.
  (Closes: #589081)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
%lex-param {CfgLexer *lexer}
36
36
%parse-param {CfgLexer *lexer}
37
37
%parse-param {gpointer *result}
 
38
%parse-param {gpointer arg}
38
39
 
39
40
 
40
41
%require "2.4.1"
72
73
          {                                                             \
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);               \
76
77
          }                                                             \
77
78
        YYERROR;                                                        \
78
79
      }                                                                 \
98
99
%token LL_CONTEXT_PRAGMA              11
99
100
%token LL_CONTEXT_FORMAT              12
100
101
%token LL_CONTEXT_TEMPLATE_FUNC       13
 
102
%token LL_CONTEXT_INNER_DEST          14
 
103
%token LL_CONTEXT_INNER_SRC           15
101
104
 
102
105
/* statements */
103
106
%token KW_SOURCE                      10000
132
135
 
133
136
%token KW_SYSLOG                      10060
134
137
 
135
 
 
136
138
/* option items */
137
139
%token KW_MARK_FREQ                   10071
138
140
%token KW_STATS_FREQ                  10072
176
178
%token KW_HOST_OVERRIDE               10166
177
179
 
178
180
%token KW_THROTTLE                    10170
 
181
%token KW_THREADED                    10171
179
182
 
180
183
/* log statement options */
181
184
%token KW_FLAGS                       10190
260
263
%token LL_EOL                         10428
261
264
%token LL_ERROR                       10429
262
265
 
 
266
/* value pairs */
 
267
%token KW_VALUE_PAIRS                 10500
 
268
%token KW_SELECT                      10501
 
269
%token KW_EXCLUDE                     10502
 
270
%token KW_PAIR                        10503
 
271
%token KW_KEY                         10504
 
272
%token KW_SCOPE                       10505
 
273
 
 
274
 
 
275
%type   <ptr> value_pair_option
263
276
 
264
277
%type   <num> yesno
265
278
%type   <num> dnsmode
420
433
        ;
421
434
 
422
435
 
 
436
/* LogSource related options */
 
437
source_option
 
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); }
 
451
        ;
 
452
 
 
453
 
423
454
source_reader_options
424
455
        : source_reader_option source_reader_options
425
456
        |
426
457
        ;
427
458
 
 
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 */
 
462
 
 
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 ')'
450
472
          {
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;
460
482
          }
 
483
        | { last_source_options = &last_reader_options->super; } source_option
461
484
        ;
462
485
 
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"); }
465
489
        |
466
490
        ;
467
491
 
 
492
dest_driver_option
 
493
        /* NOTE: plugins need to set "last_driver" in order to incorporate this rule in their grammar */
 
494
 
 
495
        : KW_LOG_FIFO_SIZE '(' LL_NUMBER ')'    { ((LogDestDriver *) last_driver)->log_fifo_size = $3; }
 
496
        | KW_THROTTLE '(' LL_NUMBER ')'         { ((LogDestDriver *) last_driver)->throttle = $3; }
 
497
        | LL_IDENTIFIER
 
498
          {
 
499
            Plugin *p;
 
500
            gint context = LL_CONTEXT_INNER_DEST;
 
501
            gpointer value;
 
502
 
 
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);
 
505
 
 
506
            value = plugin_parse_config(p, configuration, &@1, last_driver);
 
507
 
 
508
            free($1);
 
509
            if (!value)
 
510
              {
 
511
                YYERROR;
 
512
              }
 
513
            log_driver_add_plugin(last_driver, (LogDriverPlugin *) value);
 
514
          }
 
515
        ;
 
516
 
468
517
dest_writer_options
469
518
        : dest_writer_option dest_writer_options
470
519
        |
471
520
        ;
472
521
 
473
522
dest_writer_option
 
523
        /* NOTE: plugins need to set "last_writer_options" in order to incorporate this rule in their grammar */
 
524
 
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;
481
531
 
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);
484
534
                                                  free($3);
485
535
                                                }
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; }
491
541
        ;
492
542
 
493
543
dest_writer_options_flags
495
545
        |                                       { $$ = 0; }
496
546
        ;
497
547
 
 
548
value_pair_option
 
549
        : KW_VALUE_PAIRS
 
550
          { last_value_pairs = value_pairs_new(); }
 
551
          '(' vp_options ')'
 
552
          { $$ = last_value_pairs; }
 
553
        ;
 
554
 
 
555
vp_options
 
556
        : vp_option vp_options
 
557
        |
 
558
        ;
 
559
 
 
560
vp_option
 
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);
 
566
                g_free(k);
 
567
                free($3);
 
568
          }
 
569
        | KW_EXCLUDE '(' string ')'              { value_pairs_add_exclude_glob(last_value_pairs, $3); free($3); }
 
570
        | KW_SCOPE '(' vp_scope_list ')'
 
571
        ;
 
572
 
 
573
vp_scope_list
 
574
        : string vp_scope_list              { value_pairs_add_scope(last_value_pairs, $1); free($1); }
 
575
        |
 
576
        ;
 
577
 
498
578
 
499
579
%%