DX Unified Infrastructure Management

 View Only
  • 1.  logmon: Can I mach an entire phrase in a log file?

    Posted Oct 15, 2019 03:32 PM
    Hi!
    In a logmon use case, in a monitored file's line I want an alarm if and only if that line contains a certain phrase, like, say, "The dog barks". Does anyone have a good suggestion as to what the matching pattern would be? I am afraid I am ending up in a complicated regular expression. If it is at all possible...

    Thanks in advance,
    Alex

    ------------------------------
    Linkedin: www.linkedin.com/in/alexander-kuehn/
    ------------------------------


  • 2.  RE: logmon: Can I mach an entire phrase in a log file?

    Broadcom Employee
    Posted Oct 15, 2019 03:36 PM
    try
    .*The\sdog\sbarks.*

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 3.  RE: logmon: Can I mach an entire phrase in a log file?

    Posted Oct 15, 2019 03:36 PM
    You can match that with this: /.*The\sdog\sbarks.*/

    Just note that that is case-sensitive and it becomes a bit more complex if you need it case-insensitive.


  • 4.  RE: logmon: Can I mach an entire phrase in a log file?
    Best Answer

    Posted Oct 17, 2019 06:55 AM
    If it needs to be case insensitive, add the /i modifier at the end of the regex. I.e. /.*the\sdog\sbarks.*/i

    /i = ignore case