mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-19 04:30:43 +01:00
39 lines
1.6 KiB
Plaintext
39 lines
1.6 KiB
Plaintext
$IncludeConfig diag-common.conf
|
|
template(name="garply" type="string" string="garply: %$.garply%\n")
|
|
template(name="corge" type="string" string="corge: key: %$.corge!key% val: %$.corge!value%\n")
|
|
template(name="prefixed_corge" type="string" string="prefixed_corge: %$.corge%\n")
|
|
template(name="quux" type="string" string="quux: %$.quux%\n")
|
|
template(name="modified" type="string" string="new: %$!foo!str4% deleted: %$!foo!str3%\n")
|
|
|
|
module(load="../plugins/mmjsonparse/.libs/mmjsonparse")
|
|
module(load="../plugins/imptcp/.libs/imptcp")
|
|
input(type="imptcp" port="13514")
|
|
|
|
action(type="mmjsonparse")
|
|
set $.garply = "";
|
|
|
|
ruleset(name="prefixed_writer" queue.type="linkedlist" queue.workerthreads="5") {
|
|
action(type="omfile" file="./rsyslog.out.prefixed.log" template="prefixed_corge" queue.type="linkedlist")
|
|
}
|
|
|
|
foreach ($.quux in $!foo) do {
|
|
if ($.quux!key == "str2") then {
|
|
set $.quux!random_key = $.quux!key;
|
|
unset $!foo!str3; #because it is deep copied, the foreach loop will still see str3, but the 'modified' action in the bottom will not
|
|
set $!foo!str4 = "jkl3";
|
|
}
|
|
action(type="omfile" file="./rsyslog.out.log" template="quux")
|
|
foreach ($.corge in $.quux!value) do {
|
|
action(type="omfile" file="./rsyslog.out.async.log" template="corge" queue.type="linkedlist" action.copyMsg="on")
|
|
call prefixed_writer
|
|
|
|
foreach ($.grault in $.corge!value) do {
|
|
if ($.garply != "") then
|
|
set $.garply = $.garply & ", ";
|
|
set $.garply = $.garply & $.grault!key & "=" & $.grault!value;
|
|
}
|
|
}
|
|
}
|
|
action(type="omfile" file="./rsyslog.out.log" template="garply")
|
|
action(type="omfile" file="./rsyslog.out.log" template="modified")
|