Hi all,

Can someone familiar with re_extract point out what I'm doing wrong?

I have this message:

Server bk_postfix/relay5 is UP/READY (leaving forced maintenance).

that I'm attempting to match on like so:

set $.relayserver = re_extract($msg,
    "Server bk_postfix\\/([0-9A-Za-z]+)",
    0, 1,
    'unknown relay server');


According to a StackOverflow answer, the double-backslash is needed to escape the escape character. Without the double-backslash I get "invalid character" and "syntax error on token" errors from rsyslogd.

I've tried all combinations (match, submatch) that I'm aware of:

0, 0
0, 1
1, 0
1, 1

I'm getting back the string "unknown relay server" each time instead of "relay5" as expected.

Without the double backslash the "Regular Expression Checker/Generator" page gives me the results that I'm expecting with "Submatch to Use" of 1.

Thanks in advance for your help.

Rsyslog version is v8.33.0.4893d0a01391 (nightly)


refs:

* https://stackoverflow.com/a/32660580
* http://www.rsyslog.com/regex/
* http://www.rsyslog.com/doc/v8-stable/rainerscript/functions.html
_______________________________________________
rsyslog mailing list
http://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.

Reply via email to