From 8cd026b1cbb0f22f498963c862136c22d2920a15 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 1 Jul 2011 12:40:29 +0200 Subject: milestone: grammar contains rules for object blocks --- grammar/debian.new | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ grammar/rscript.l | 60 +++++++++++++++++++++--------- 2 files changed, 149 insertions(+), 18 deletions(-) create mode 100644 grammar/debian.new (limited to 'grammar') diff --git a/grammar/debian.new b/grammar/debian.new new file mode 100644 index 00000000..a6574f62 --- /dev/null +++ b/grammar/debian.new @@ -0,0 +1,107 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +module( + name=imuxsock # provides support for local system logging + ) +$ModLoad imklog # provides kernel logging support (previously done by rklogd) +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 +module(name=imudp) +input(type=imudp port=514) + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + news.none;mail.none -/var/log/debug +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg * + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole + +global (dnscache=yes arg1="1 2" arg2 = "1 2" arg3 ="1=2\"3") +# samples added to get full "flavor" of what we need to support... +:msg, contains, "error" /var/log/somelog +action(type=omfile target=/var/log/mail/log) +*.* * # test +*.info :ommysql:, tra, la , la # comment (comment to be part of old style line!) diff --git a/grammar/rscript.l b/grammar/rscript.l index dd86fbe9..b5d23d7a 100644 --- a/grammar/rscript.l +++ b/grammar/rscript.l @@ -1,41 +1,65 @@ %option noyywrap nodefault case-insensitive /*%option noyywrap nodefault case-insensitive */ -%x OLDACT - /* old-style action expected -- need to parse differently */ +%x INOBJ + /* INOBJ is selected if we are inside an object (name/value pairs!) */ %{ #include %} %% - -\$[a-z]+.*$ { printf("CFSYSLINE: '%s'\n", yytext); } - +"global"[ \n\t]*"(" { printf("OBJ GLOBAL begin\n"); + BEGIN INOBJ; + } +"input"[ \n\t]*"(" { printf("OBJ INPUT begin\n"); + BEGIN INOBJ; + } +"module"[ \n\t]*"(" { printf("OBJ MODULE begin\n"); + BEGIN INOBJ; + } +"action"[ \n\t]*"(" { printf("OBJ ACTION begin\n"); + BEGIN INOBJ; + } ^[ \t]*:\$?[a-z]+[ ]*,[ ]*!?[a-z]+[ ]*,[ ]*\".*\" { printf("PROP-FILT: '%s'\n", yytext); - BEGIN OLDACT; + /*BEGIN OLDACT;*/ } ^[ \t]*[,\*a-z]+\.[,!=;\.\*a-z]+ { printf("PRI-FILT: '%s'\n", yytext); - BEGIN OLDACT; + /*BEGIN OLDACT;*/ } - -#.*\n /* skip comments in input */ -.|\n { if(yytext[0] != '\n') printf("%s", yytext); } -\* | --\/[^ \t\n]+ | -\|[^ \t\n]+ | -\/[^ \t\n]+ { printf("old style action: '%s'\n", yytext); - BEGIN INITIAL; +"*" | +[\|\.\/\-:][^\n]+ { printf("old style action: '%s'\n", yytext); + } + +")" { printf("OBJ end\n"); + BEGIN INITIAL; + } +[a-z][a-z0-9_]* { printf("INOBJ: name '%s'\n", yytext); + } +"=" { printf("INOBJ: equals\n"); } -[ \t\n] -.|\n { printf("invalid sequence in OLDACT mode: %s\n", - yytext); +[a-z0-9\.,_\+\-\/]* | +\"([^"\\]|\\['"?\\abfnrtv]|\\[0-7]{1,3})*\" { + printf("INOBJ: value '%s'\n", yytext); + BEGIN INOBJ; } +#.*\n /* skip comments in input */ +[ \n\t] +. { printf("INOBJ: invalid char '%s'\n", yytext); } + /* CFSYSLINE is valid in all modes */ +\$[a-z]+.*$ { printf("CFSYSLINE: '%s'\n", yytext); } +\$[a-z]+.*$ { printf("CFSYSLINE: '%s'\n", yytext); } + +\#.*\n /* skip comments in input */ +[\n\t ] /* drop whitespace */ +. { printf("invalid char: %s\n", yytext); + } + /*<> { printf("EOF reached\n"); }*/ %% int -- cgit