Ad Widget

Collapse

Get advice on Zabbix Items Key regular expressions.

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ywm
    Junior Member
    • Feb 2025
    • 3

    #1

    Get advice on Zabbix Items Key regular expressions.

    Please give us advice on the Zabbix entry key regular expression

    Hello, I am a user using zabbix in Korea.

    logrt.count["/example/.*/([0-9]{1,5}_)?[a-zA-Z]{1,30}\.log$","INFO",,1000,skip]

    I'm going to apply it to Zabbix item key like key above to collect the strings of all the log files in directory below example directory.
    When you register item by applying key above, Not found directoy error is marked and the item status is marked "Not supported".
    It works well if you insert the original directory name without expressing the subdirectory with a regular expression.
    There are about 15 subdirectories, so I want to manage them as one item. Is there a regular expression that includes all directories in the Zabbix item key regular expression? Or let me know if there is any other good way.

    Thank you!
    Last edited by ywm; 24-02-2025, 09:24.
  • Answer selected by ywm at 26-02-2025, 02:03.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    in case of logrt items, regex is only the filename part. path cannot be regexed. It is first thing mentioned in docs...
    logrt[file_regexp,<regexp>,<encoding>,<maxlines>,<mode>, <output>,<maxdelay>,<options>,<persistent_dir>]
    Monitoring of a log file that is rotated. Log file_regexp - absolute path to file, with the file name specified using a regular expression. Note that the regular expression applies only to the file name and does not need to match the entire name (e.g., /path/to/agent will match zabbix_agentd.log)

    You can not use 1 item of rmany logs. It always picks the latest matching logfile...not all matching logfiles..

    Comment


    • ywm
      ywm commented
      Editing a comment
      Thank you for your help.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    in case of logrt items, regex is only the filename part. path cannot be regexed. It is first thing mentioned in docs...
    logrt[file_regexp,<regexp>,<encoding>,<maxlines>,<mode>, <output>,<maxdelay>,<options>,<persistent_dir>]
    Monitoring of a log file that is rotated. Log file_regexp - absolute path to file, with the file name specified using a regular expression. Note that the regular expression applies only to the file name and does not need to match the entire name (e.g., /path/to/agent will match zabbix_agentd.log)

    You can not use 1 item of rmany logs. It always picks the latest matching logfile...not all matching logfiles..

    Comment


    • ywm
      ywm commented
      Editing a comment
      Thank you for your help.
Working...