Skip to content

Commit

Permalink
Rsyslog: support dynamic file paths (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink authored Apr 12, 2019
1 parent 97a7063 commit 6496f85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lenses/rsyslog.aug
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ let omusrmsg = Util.del_str ":omusrmsg:" .
File action with a specified template *)
let file_tmpl = Syslog.file . [ label "template" . Util.del_str ";" . store Rx.word ]

let dynamic = [ Util.del_str "?" . label "dynamic" . store Rx.word ]

let namedpipe = Syslog.pipe . Sep.space . [ label "pipe" . store Syslog.file_r ]

let action = Syslog.action | omusrmsg | file_tmpl | namedpipe
let action = Syslog.action | omusrmsg | file_tmpl | dynamic | namedpipe

(* Cannot use syslog program because rsyslog does not suppport #! *)
let program = [ label "program" . Syslog.bang .
Expand Down
12 changes: 12 additions & 0 deletions lenses/tests/test_rsyslog.aug
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,15 @@ test Rsyslog.lns get "include(file=\"/etc/rsyslog.d/*.conf\" mode=\"optional\")\
{ "include"
{ "file" = "/etc/rsyslog.d/*.conf" }
{ "mode" = "optional" } }

(* Dynamic file name template *)
test Rsyslog.lns get "*.* ?DynamicFile\n" =
{ "entry"
{ "selector"
{ "facility" = "*" }
{ "level" = "*" }
}
{ "action"
{ "dynamic" = "DynamicFile" }
}
}

0 comments on commit 6496f85

Please sign in to comment.