Ad Widget

Collapse

Zabbix 6.0.19: how to monitor dynamically generated logs?

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • paxas
    Junior Member
    • Jan 2024
    • 13

    #1

    Zabbix 6.0.19: how to monitor dynamically generated logs?

    On a Windows server i have a file directory where the logs from 2 different processes are being stored.

    After each run these processes generate a separate .log file. One process runs 2 times every day, while the other runs 1 time per week. The exact hours vary widely.

    I need to monitor only the newest .log files and search for certain keyword in them.

    I read through documentation and some old discussions and attempted to create and Item Key like this (note: for testing purposes i tried to implement the log monitoring for just 1 of the 2 processes):

    log[C:\temp\Jumis[A-Za-z]{5}\s-\s[A-Za-z]{5}\sfrom\s[A-Z]{4}\sto\s[A-Z]{3}\s[A-Z0-9_]{15,25}\([a-z0-9]{15}\).log,Failed,,,skip]

    However, this resulted in error: "Cannot update item. Invalid key".

    I verified in regex101.com that "Jumis[A-Za-z]{5}\s-\s[A-Za-z]{5}\sfrom\s[A-Z]{4}\sto\s[A-Z]{3}\s[A-Z0-9_]{15,25}\([a-z0-9]{15}\).log" matches all the sample log file names that i tested.

    I tried various minor adjustments, like putting around the commas, etc. but it did not help.

    So what would be the correct way to capture the log file name that is subject to change with every new generation?​
  • Answer selected by paxas at 08-01-2024, 11:39.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    first... use logrt(). log() requires hardcoded filename, as it is not meant for rotating files as you have there... for logrt you specify name with regex.
    And you can put filename in ""-s just in case... All the windows and spaces in filenames is a pain in backside... May need also some extra escaping...

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #2
      first... use logrt(). log() requires hardcoded filename, as it is not meant for rotating files as you have there... for logrt you specify name with regex.
      And you can put filename in ""-s just in case... All the windows and spaces in filenames is a pain in backside... May need also some extra escaping...

      Comment

      Working...