summaryrefslogtreecommitdiffstats
path: root/grammar
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-01 12:40:29 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-01 12:40:29 +0200
commit8cd026b1cbb0f22f498963c862136c22d2920a15 (patch)
tree316d8f90028b38a2b042a44a08ae1c963f58312f /grammar
parent1f69bcb67fad8920867120b8ad310b5f60a7cc62 (diff)
downloadrsyslog-8cd026b1cbb0f22f498963c862136c22d2920a15.tar.gz
rsyslog-8cd026b1cbb0f22f498963c862136c22d2920a15.tar.xz
rsyslog-8cd026b1cbb0f22f498963c862136c22d2920a15.zip
milestone: grammar contains rules for object blocks
Diffstat (limited to 'grammar')
-rw-r--r--grammar/debian.new107
-rw-r--r--grammar/rscript.l60
2 files changed, 149 insertions, 18 deletions
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 <libestr.h>
%}
%%
-
-\$[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); }
-<OLDACT>\* |
-<OLDACT>-\/[^ \t\n]+ |
-<OLDACT>\|[^ \t\n]+ |
-<OLDACT>\/[^ \t\n]+ { printf("old style action: '%s'\n", yytext);
- BEGIN INITIAL;
+"*" |
+[\|\.\/\-:][^\n]+ { printf("old style action: '%s'\n", yytext);
+ }
+
+<INOBJ>")" { printf("OBJ end\n");
+ BEGIN INITIAL;
+ }
+<INOBJ>[a-z][a-z0-9_]* { printf("INOBJ: name '%s'\n", yytext);
+ }
+<INOBJ>"=" { printf("INOBJ: equals\n");
}
-<OLDACT>[ \t\n]
-<OLDACT>.|\n { printf("invalid sequence in OLDACT mode: %s\n",
- yytext);
+<INOBJ>[a-z0-9\.,_\+\-\/]* |
+<INOBJ>\"([^"\\]|\\['"?\\abfnrtv]|\\[0-7]{1,3})*\" {
+ printf("INOBJ: value '%s'\n", yytext);
+ BEGIN INOBJ;
}
+<INOBJ>#.*\n /* skip comments in input */
+<INOBJ>[ \n\t]
+<INOBJ>. { printf("INOBJ: invalid char '%s'\n", yytext); }
+ /* CFSYSLINE is valid in all modes */
+\$[a-z]+.*$ { printf("CFSYSLINE: '%s'\n", yytext); }
+<INOBJ>\$[a-z]+.*$ { printf("CFSYSLINE: '%s'\n", yytext); }
+
+\#.*\n /* skip comments in input */
+[\n\t ] /* drop whitespace */
+. { printf("invalid char: %s\n", yytext);
+ }
+ /*<<EOF>> { printf("EOF reached\n"); }*/
%%
int