ahh, the rsyslog output shows errors. I don't see any way of knowing that a single \ is wrong.

I think this is a case where the config output will help as it would not see a need to escape the . and would output the regex without the \

David Lang

On Thu, 16 May 2019, Rainer Gerhards wrote:

El jue., 16 may. 2019 a las 19:11, David Lang (<[email protected]>) escribió:

You already ask if there is an invalid escape sequence, possibly showing the
full string that you have parsed to the point of the error?? (unless  it gets
too long I guess)

actually rsyslog does not see or generate an error. It's just that the
regex does not work because it is missing the backslash. But we don't
know it was actually meant as a backslash rather than an escape
character.

Granted, we could err out on '\.' and declare backslash cannot be used
prior to dot. But this behavior is so for over 10 years and I am
hesitant to change that...

Rainer

David Lang

On Thu, 16 May 2019, Rainer Gerhards via rsyslog wrote:

Great to hear! It's not that intuitive, I know. Any idea how to make
this more obvious to users?

Rainer

El jue., 16 may. 2019 a las 16:59, Joan (<[email protected]>) escribió:

Thanks a lot, it's working now

Missatge de Rainer Gerhards <[email protected]> del dia dj., 16 de maig 
2019 a les 11:03:

El jue., 16 may. 2019 a las 9:57, Joan via rsyslog
(<[email protected]>) escribió:

I am trying the expression below to detect the time format from java
(13-May-2019 09:18:42.268)

     startmsg.regex="^[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}
[[:digit:]]{1,2}:[[:digit:]]{1,2}:[[:digit:]]{1,2}\.[[:digit:]]{3}"

It works fine except for the \. to match an explicit dot

Note that you are specifiying a string. Backslash escapes special
characters inside a string (just like in many programming and
scripting languages). So to get one backslash in the final result, you
need to give two. Like this:

startmsg.regex="^[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}
[[:digit:]]{1,2}:[[:digit:]]{1,2}:[[:digit:]]{1,2}\\.[[:digit:]]{3}"

HTH
Rainer

rsyslogd: error during parsing file /etc/rsyslog.d/45-config.conf, on or
before line 17: invalid character '"' in object definition - is there an
invalid escape sequence somewhere? [v8.1904.0 try
https://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/45-config.conf, on or
before line 17: invalid character '^' in object definition - is there an
invalid escape sequence somewhere? [v8.1904.0 try
https://www.rsyslog.com/e/2207 ]
rsyslogd: error during parsing file /etc/rsyslog.d/45-config.conf, on or
before line 17: syntax error on token '[' [v8.1904.0 try
https://www.rsyslog.com/e/2207 ]
rsyslogd: could not interpret master config file '/etc/rsyslog.conf'.
[v8.1904.0 try https://www.rsyslog.com/e/2207 ]

Is there another syntax I'm missing?
I am Using 8.1904.0-0adiscon1bionic1 from the adiscon ppa

Regards,

Joan
_______________________________________________
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.
_______________________________________________
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.

_______________________________________________
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