Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-15010

Regex in "log" item causes "cannot compile regular expression" error

XMLWordPrintable

    • Sprint 45, Sprint 46, Nov 2018
    • 0.125

      Steps to reproduce:

      1. Create log item with this regex: 
        (\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\.\d{2}\s+\w+\s+)Error:.+((\r\n|\r|\n)\1{1}.+){0,}
      1. Wait for the item to become unsupported with "cannot compile regular expression" error

      Result:

      Item configuration:

      Agent log:

      11880:20181015:120836.677 In process_log() filename:'d:\fake-log\fake.log' lastlogsize:0 mtime:0
       11880:20181015:120836.677 convert_to_utf8() in_size:212 encoding:'UTF-16' codepage:1200
       11880:20181015:120836.678 End of process_log() filename:'d:\fake-log\fake.log' lastlogsize:0 mtime:0 ret:FAIL processed_bytes:0
       11880:20181015:120836.678 End of process_logrt():FAIL
       11880:20181015:120836.678 active check "log["d:\fake-log\fake.log","(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\.\d{2}\s+\w+\s+)Error:.+((\r\n|\r|\n)\1{1}.+){0,}","UTF-16"]" is not supported: cannot compile regular expression
       11880:20181015:120836.679 In process_value() key:'S001WDSD001:log["d:\fake-log\fake.log","(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\.\d{2}\s+\w+\s+)Error:.+((\r\n|\r|\n)\1{1}.+){0,}","UTF-16"]' value:'cannot compile regular expression'
      

      Expected:

      Log item should be able to use regex and parse log file.

      Notes

      This regex is interned to parse multi-line log messages and it's works in Zabbix regex tester (Administration -> General -> Regular Expressions) and pcre2test tool.

            vjaceslavs Vjaceslavs Bogdanovs
            beatcracker beatcracker
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: