Mailing List Archive

Debug memVars & empty 'else if' in ruleset
Hello RSyslog Community,

Two issues I’ve encountered and wanted to check if anyone also
observed the following?

#### debug memVars

When I set various debug options using the RSYSLOG_DEBUG and
RSYSLOG_DEBUGLOG memVars, the results are intermittent. For example,
when I set ‘NoStdOut’ or the actual debug log file, neither seem to
have any effect. But when I set these same options in the config file,
all works well.

#### Emtpy ‘else if’ in a ruleset

When I commented out the only statement under an ‘else if’ control
structure, thereby leaving that ‘else if’ empty, I discovered that
the entire ruleset was ignored. Once I either reverted the commented
the statement, commented out the actual ‘else if’, or added a new
statement under the ‘else if’, RSyslog returned to expected
behavior.

For example, these work fine:

```
ruleset(name="fwd_ALL") {
if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
action(type="omfwd" Target="xxx.xxx.xxx.xxx" Port="514" Protocol="udp"
Device="eth0" action.resumeRetryCount="100" queue.type="linkedList"
queue.filename="fwd_svr1" queue.size="10000" queue.saveOnShutdown="on")
# /var/log/0.TEST.from_srv1.log
} else if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
/var/log/0.TEST.from_srv2.log
}
stop
}
```

```
ruleset(name="fwd_ALL") {
if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
action(type="omfwd" Target="xxx.xxx.xxx.xxx" Port="514" Protocol="udp"
Device="eth0" action.resumeRetryCount="100" queue.type="linkedList"
queue.filename="fwd_svr1" queue.size="10000" queue.saveOnShutdown="on")
# /var/log/0.TEST.from_srv1.log
# } else if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
# /var/log/0.TEST.from_srv2.log
}
stop
}
```
```
ruleset(name="fwd_ALL") {
if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
action(type="omfwd" Target=“xxx.xxx.xxx.xxx” Port="514"
Protocol="udp" Device="eth0" action.resumeRetryCount="100"
queue.type="linkedList" queue.filename="fwd_svr1" queue.size="10000"
queue.saveOnShutdown="on")
# /var/log/0.TEST.from_srv1.log
} else if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
# /var/log/0.TEST.from_srv2.log
/var/log/0.TEST-2nd.from-srv2.log
}
stop
}
```
But this does not work:

```
ruleset(name="fwd_ALL") {
if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
action(type="omfwd" Target="xxx.xxx.xxx.xxx" Port="514" Protocol="udp"
Device="eth0" action.resumeRetryCount="100" queue.type="linkedList"
queue.filename="fwd_svr1" queue.size="10000" queue.saveOnShutdown="on")
# /var/log/0.TEST.from_srv1.log
} else if ($fromhost-ip == 'xxx.xxx.xxx.xxx') then {
# /var/log/0.TEST.from_srv2.log
}
stop
}
```

_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.