Regex not matching

Issue #598 closed
Michael Wedderburn created an issue

I'm trying to use regex in my monit config but it doesn't appear to be matching. Monit config is as follows (I suspect it may be trying to match it as string?). This is on Cent OS 7, monit version 5.14

check file ha with path /var/log/ha.log
    if match ".*?(api).*?(204)[\s]" then alert

log line looks like ..

[20/Apr/2017:17:07:04.982] nginx~ api/web1 172/0/1/43/217 204 291 - - ---- 443/321/0/0/0 0/0 "POST /ep/test HTTP/1.1"

Comments (3)

  1. Tildeslash repo owner

    Monit uses system's posix regex library, for example the following string matches your input:

    check file ha with path /tmp/ha.log
        if match "api.*204" then alert
    
  2. Log in to comment