Ad Widget

Collapse

Log file monitoring - Posix Regular Expressions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luissma
    Junior Member
    • Jul 2008
    • 16

    #1

    Log file monitoring - Posix Regular Expressions

    I'm trying to monitor log files using Posix expressions with following item, and it works ok:

    Type: Zabbix agent (active)
    Type of information: Log
    Key: log[example.log,[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}]



    When I try to retrieve several consecutive lines using a more complex regular expression like the one in this key:

    log[example.log,[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}.*\nERROR.*\nFAIL]

    it doesn't work even if it is a Posix regular expression.


    This regular expression has been tested with zabbix_sender command. Following command works ok on client system, it extracts lines I'm looking for:

    /usr/local/sbin/zabbix_sender -z <zabbix_server> -p 10051 -s <hostname> -k trap-item -o "`/bin/grep -P "[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}.*\nERROR.*\nFAIL" example.log`"
    Last edited by luissma; 08-10-2009, 11:23.
  • luissma
    Junior Member
    • Jul 2008
    • 16

    #2
    Log file monitoring - Posix Regular Expressions

    ...by the way, I've already applied this "patch" that solves the new line character problem: https://support.zabbix.com/browse/ZBX-235

    Comment

    Working...