3 Parses /etc/rsyslog.conf
5 Author: Raphael Pinson <raphael.pinsons@camptocamp.com>
8 This lens tries to keep as close as possible to `man 5 rsyslog.conf` where possible.
11 This file is licenced under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens applies to /etc/rsyslog.conf. See <filter>.
20 The <Test_Rsyslog> file contains various examples and tests.
26 let macro_rx = /[^,# \n\t][^#\n]*[^,# \n\t]|[^,# \n\t]/
27 let macro = [ key /$[A-Za-z0-9]+/ . Sep.space . store macro_rx . Util.comment_or_eol ]
29 let config_object_param = [ key /[A-Za-z]+/ . Sep.equal . Quote.dquote
30 . store /[^"]+/ . Quote.dquote . Sep.opt_space ]
31 let config_object = [ key /action|global|input|module|parser|timezone/ . Sep.lbracket
32 . config_object_param+ . Sep.rbracket . Util.comment_or_eol ]
35 Map :omusrmsg: and a list of users, or a single *
37 let omusrmsg = Util.del_str ":omusrmsg:" .
38 Syslog.label_opt_list_or "omusrmsg" (store Syslog.word)
42 File action with a specified template *)
43 let file_tmpl = Syslog.file . [ label "template" . Util.del_str ";" . store Rx.word ]
45 let namedpipe = Syslog.pipe . Sep.space . [ label "pipe" . store Syslog.file_r ]
47 let action = Syslog.action | omusrmsg | file_tmpl | namedpipe
50 An entry contains selectors and an action
52 let entry = [ label "entry" . Syslog.selectors . Syslog.sep_tab .
53 [ label "action" . action ] . Util.eol ]
56 Parses property-based filters, which start with ":" and the property name *)
58 let sep = Sep.comma . Util.del_opt_ws " "
59 in let prop_name = [ Util.del_str ":" . label "property" . store Rx.word ]
60 in let prop_oper = [ label "operation" . store /[A-Za-z!-]+/ ]
61 in let prop_val = [ label "value" . Quote.do_dquote (store /[^\n"]*/) ]
62 in let prop_act = [ label "action" . action ]
63 in [ label "filter" . prop_name . sep . prop_oper . sep . prop_val .
64 Sep.space . prop_act . Util.eol ]
66 let entries = ( Syslog.empty | Syslog.comment | entry | macro | config_object | prop_filter )*
68 let lns = entries . ( Syslog.program | Syslog.hostname )*
70 let filter = incl "/etc/rsyslog.conf"
72 let xfm = transform lns filter