Ad Widget

Collapse

How to count the number of logs that match a regular expression per minute.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • trinet
    Junior Member
    • Sep 2021
    • 3

    #1

    How to count the number of logs that match a regular expression per minute.

    Hello all,

    I would like to count the number of logs that match a regular expression per minute.
    and I also want to get the log strings.

    So I created the Tempalte like bellow

    but I get the error
    Cannot evaluate function: item "/<host>/test_log" does not exist at "count(//test_log,1m)".

    any help would be appreciated


    Ubuntu 22.04 arm64
    Zabbix server 7.0.0 arm64
    Zabbix agent2 7.0.0 x86_64
    MySQL 8.0.37

    Template: Template_test

    ---
    Regular expression
    Sample : SAMPLE/[0-9].[0-9]

    ---
    Name : test_log
    Type : Zabbix agent (active)
    Key : log["/tmp/test.log", Sample]
    Type of information : log
    Update interval : 1m

    ---
    Name : test_count
    Type : Calculated
    Key : test_count
    Formula : count(//test_log,1m)
    Type of information : Numeric(integer)
    Update interval : 1m

    regards
  • BigSmooth
    Member
    • Jun 2023
    • 46

    #2
    Hello,

    log.count seems to do the trick, but it requires active mode.

    Regards,
    Olivier

    Comment

    Working...