File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,18 @@ detailed semantics documentation.
1212RainerScript supports following control structures:
1313
1414**if **:
15+
1516::
17+
1618 if ($msg contains "important") then {
1719 if ( $. foo != "" ) then set $.foo = $.bar & $.baz;
1820 action(type="omfile" file="/var/log/important.log" template="outfmt")
1921 }
2022
2123**if/else-if/else **:
24+
2225::
26+
2327 if ($msg contains "important") then {
2428 set $.foo = $.bar & $.baz;
2529 action(type="omfile" file="/var/log/important.log" template="outfmt")
@@ -31,7 +35,9 @@ RainerScript supports following control structures:
3135 }
3236
3337**foreach **:
38+
3439::
40+
3541 foreach ($.quux in $!foo) do {
3642 action(type="omfile" file="./rsyslog.out.log" template="quux")
3743 foreach ($.corge in $.quux!bar) do {
Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ variable already contains a value its behaviour differs as follows:
3434
3535**merges ** the value if both existing and new value are objects,
3636but merges the new value to *root * rather than with value of the given key. Eg.
37+
3738::
39+
3840 set $.x!one = "val_1";
3941 # results in $. = { "x": { "one": "val_1" } }
4042 set $.y!two = "val_2";
@@ -48,22 +50,28 @@ but merges the new value to *root* rather than with value of the given key. Eg.
4850 # note that the key *two* is at root level and not under *$.z!var*.
4951
5052**ignores ** the new value if old value was an object, but new value is a not an object (Eg. string, number etc). Eg:
53+
5154::
55+
5256 set $.x!one = "val_1";
5357 set $.x = "quux";
5458 # results in $. = { "x": { "one": "val_1" } }
5559 # note that "quux" was ignored
5660
5761**resets ** variable, if old value was not an object.
62+
5863::
64+
5965 set $.x!val = "val_1";
6066 set $.x!val = "quux";
6167 # results in $. = { "x": { "val": "quux" } }
6268
6369**unset **
6470---------
6571removes the key. Eg:
72+
6673::
74+
6775 set $.x!val = "val_1";
6876 unset $.x!val;
6977 # results in $. = { "x": { } }
@@ -72,7 +80,9 @@ removes the key. Eg:
7280---------
7381force sets the new value regardless of what the variable
7482originally contained or if it was even set. Eg.
83+
7584::
85+
7686 # to contrast with the set example above, here is how results would look with reset
7787 set $.x!one = "val_1";
7888 set $.y!two = "val_2";
You can’t perform that action at this time.
0 commit comments