- changed status to closed
Monit configuration escaping match pattern string
Issue #75
closed
am using php and bash to generate monit configuration file /etc/monit.conf I have a problem in escaping double quote and single in ignore match pattern rule
I am using php preg_quote() function to escape the user input text I have try to quote the string with double quote and escaped the double quote inside with
\ and \\ => Error: regex parsing error:Trailing backslash
and \\\ => Error: syntax error '\*\?\[\^\]\$\'
## Monitoring log files
Check file file.log with path /file/path
ignore match "\\\+\"\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:\-"
if match "ERROR" then alert
Same thing with simple quote
## Monitoring log files
Check file file.log with path /file/path
ignore match '\\\+\'\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:\-'
if match "ERROR" then alert
I have search in google for possible solution with no chance
I hope someone have resolved this before
Comments (1)
-
repo owner - Log in to comment
Please note that Monit is using POSIX regex not pcre (Perl Compatible Regular Expressions) so you need to adjust for that. Hint use character classes