[ZBX-18168] unclear what regexp causes error for regexp_exec() function Created: 2020 Jul 30  Updated: 2024 Apr 10  Resolved: 2023 Sep 18

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 4.0.22, 5.0.2
Fix Version/s: 6.0.22rc1, 6.4.7rc1, 7.0.0alpha5, 7.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Oleksii Zagorskyi Assignee: Andris Mednis
Resolution: Fixed Votes: 2
Labels: logmonitoring
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File 0001-.G.PS.-ZBX-18168-added-logging-the-pattern-in-regexp.patch     File regexp.diff     PNG File screenshot-1.png     PNG File screenshot-2.png    
Issue Links:
Duplicate
is duplicated by ZBX-21354 zabbix-proxy : regexp_exec() failed ... Closed
Sub-task
Team: Team C
Sprint: Sprint 67 (Aug 2020), Sprint 68 (Sep 2020), Sprint 69 (Oct 2020), Sprint 70 (Nov 2020), Sprint 71 (Dec 2020), Sprint 72 (Jan 2021), Sprint 73 (Feb 2021), Sprint 74 (Mar 2021), Sprint 75 (Apr 2021), Sprint 76 (May 2021), Sprint 77 (Jun 2021), Sprint 78 (Jul 2021), Sprint 79 (Aug 2021), Sprint 80 (Sep 2021), Sprint 81 (Oct 2021), Sprint 82 (Nov 2021), Sprint 83 (Dec 2021), Sprint 84 (Jan 2022), Sprint 85 (Feb 2022), Sprint 86 (Mar 2022), Sprint 87 (Apr 2022), Sprint 88 (May 2022), Sprint 89 (Jun 2022), Sprint 90 (Jul 2022), Sprint 91 (Aug 2022), Sprint 92 (Sep 2022), Sprint 93 (Oct 2022), Sprint 94 (Nov 2022), Sprint 95 (Dec 2022), Sprint 96 (Jan 2023), Sprint 97 (Feb 2023), Sprint 98 (Mar 2023), Sprint 99 (Apr 2023), Sprint 100 (May 2023), Sprint 101 (Jun 2023), Sprint 102 (Jul 2023), Sprint 103 (Aug 2023), Sprint 104 (Sep 2023)
Story Points: 10

 Description   

We have a lot of log* items with regexp and output group in item key.
In agent log we have this repeatable warning:

regexp_exec() failed with error -8

but we are not able to figure out what item(s?) cause that.

Could be the message extended to include the regexps itself?

p.s. as I see the function receives regexp - [IN] precompiled regular expression.
Not sure if that variable could be simply included as text to the message.



 Comments   
Comment by Andris Mednis [ 2020 Oct 05 ]

Reproduced in a rough way in release/4.0:

  • modified src/libs/zbxregexp/zbxregexp.c:
    @@ -245,6 +245,7 @@ static int  regexp_exec(const char *string, const zbx_regexp_t *regexp, int flags
            pextra->match_limit_recursion = recursion_limit;
     #endif
     #endif
    +pextra->match_limit = 1;
            /* see "man pcreapi" about pcre_exec() return value and 'ovector' size and layout */
            if (0 <= (r = pcre_exec(regexp->pcre_regexp, pextra, string, strlen(string), flags, 0, ovector, ovecsize)))
    
  • with test item
    log[/home/zabbix40/test.log,.*?test.*?abc,,,skip,\1\2\3\4\5\6,,mtime-noreread]
    
  • and a test line in log file:
    testabctestabctestabctestabc
    

    Observed in agent log:

     53917:20201005:181602.362 regexp_exec() failed with error -8
     53917:20201005:181602.362 regexp_exec() failed with error -8
    

    Item remains in status "Enabled".

/usr/include/pcre.h shows what is -8:

#define PCRE_ERROR_MATCHLIMIT       (-8)
Comment by Andris Mednis [ 2023 Aug 08 ]

Available in versions:

Comment by Martins Valkovskis [ 2023 Aug 10 ]

Updated documentation:

Generated at Fri May 02 09:05:43 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.