[rsyslog] Unable to figure out regex and regex checker.

2022-11-30 Thread Arild Sæther via rsyslog
Hi, I thought I was fairly useful at regexes, until I met rsyslog. Which has me severely stumped. I am trying to parse a really simple string: ncy-rest01-hel.example.com to extract the "nyc" part (i.e everything in front of the '-' ). Now, usually I would simply use: (\w*)-.* and point at th

Re: [rsyslog] Unable to figure out regex and regex checker.

2022-12-01 Thread Arild Sæther via rsyslog
Hi, Thanks! That works in the regex tool, but the funny thing is that in the template string, I need to specify capture group 2, not 1. I expected "%hostname:R,ERE,1,ZERO:((\\w*)-.*)--end%" to work, but that returns the full match (i.e. "0" in the regex tool), but I need to use "%hostname:R,ERE