> -----Original Message----- > From: [email protected] [mailto:rsyslog- > [email protected]] On Behalf Of [email protected] > Sent: Tuesday, September 11, 2012 6:31 PM > To: rsyslog-users > Subject: Re: [rsyslog] How to escape backslash in rainerscript > if...then conditions > > On Tue, 11 Sep 2012, Radu Gheorghe wrote: > > > Hi to all rsysloggers :) > > > > If I want to configure my rsyslog 6.4.1 to do something like: > > > > if $msg contains '|\/|onster' then /var/log/monster > > > > it fails giving something like: > > 7434.868138334:7fbd708fd700: invalid char in expr: ' > > 7434.868146274:7fbd708fd700: XXXX: msg: syntax error > > > > I get the same error if I use a double-backslash there: > > > > if $msg contains '|\\/|onster' then /var/log/monster > > > > So my question is: how to escape the backslash and avoid the syntax > error? > > > > Any clues will be deeply appreciated :) > > one common problem is single vs double quotes. I always get mixed up > over > which is supported and which is 'reserved for future use'. so my fitst > suggestion would be to try double quotes. the fact that the error seems > to > be complaining about the single quote also makes me think this may be > the > issue.
Single quotes is right. But I have to admit I need to look this up. Maybe it's an oversight... ;) Rainer PS: Double-quotes are reserved for in-string property access, like "message is $msg", as known from a couple of languages. I have to admit I am no longer sure that's really a good idea... _______________________________________________ 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

