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

Wierd behaviour of regsub on ITEM depending on context

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.2.3
    • Templates (T)
    • None

      I have a log line like:

      ERROR 2017-02-06 15:55:06,547 django mycontent multiple content page. choosing first: {'body': {'query': {'filtered': {'filter': {'bool': {'must': [{'term': {'slug_tag.raw': u'myslug'}}, {'term': {'lang_tag.raw': 'en-US'}}]}}}}}, 'index': 'my_content', 'doc_type': 'page'}"
      

      I extract the error message with the following expression:

      (({myhost:logrt[/var/log/uwsgi/my_error_log,".*ERROR.*"].regexp(.*django mycontent multiple content page.*)})<>0)
      

      Then i use the following in the trigger name:

      uwsgi log: {{ITEM.VALUE}.regsub(".*\'slug_tag.raw\': u\'(.*)\'\}\}\,", "Slug: \1")} {{ITEM.VALUE}.regsub(".*\'lang_tag.raw\': \'(.*)\'\}\}\]", "Lang: \1")}
      

      Note: As you can see i have to escape some of the special chars else it would not resolve properly.

      So far so good... but now trying to use the following tags fails:

      Slug {{ITEM.VALUE}.regsub(".*\'slug_tag.raw\': u\'(.*)\'\}\}\,", "\1")}
      Lang {{ITEM.VALUE}.regsub(".*\'lang_tag.raw\': \'(.*)\'\}\}\]", "\1")}
      

      The tags Slug and Lang will not resolve to the assigned value. In fact they stay empty.

      After toying around with it i found out that in tags i am not allowed to escape the chars that were required to escape in the Name tag... so what worked was:

      Slug {{ITEM.VALUE}.regsub(".*'slug_tag.raw': u'(.*)'}},", "\1")}
      Lang {{ITEM.VALUE}.regsub(".*'lang_tag.raw': '(.*)'}}]", "\1")}
      

      I am reporting this because the behaviour is inconsistent.

            Unassigned Unassigned
            che666 Rudolf Kastl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: