[ZBXNEXT-5085] Report an error if regexp output template references non-existing or unmatched groups Created: 2019 Mar 02  Updated: 2023 Sep 11

Status: Confirmed
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G), Frontend (F), Server (S)
Affects Version/s: 4.2.0beta2
Fix Version/s: None

Type: Change Request Priority: Critical
Reporter: Glebs Ivanovskis Assignee: Konstantins Prutkovs
Resolution: Unresolved Votes: 0
Labels: logmonitoring, macrofunction, preprocessing, regex, troubleshooting, usability, validation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Documentation (e.g. here) says:

\N (where N=1…9) escape sequence is replaced with Nth matched group (or an empty string if the N exceeds the number of captured groups).

I would like to urge Zabbix to change this behaviour and raise errors instead of silently replacing escape sequences with emptiness. This will help prevent user errors like ZBX-15743. See this comment to get the idea of how small was the mistake... Then scroll the whole issue to get the idea of how much time and how many people it took to troubleshoot.

P.S. This change can theoretically break a lot of existing items, macro functions, preprocessing rules, etc. But in practice, I think, it won't. On August 10, 2018 ZBX-13730 introduced a bug in 3.4.13rc1 and 4.0.0alpha10 which caused escape sequence for non-existing or not captured groups to be unpredictable. It was discovered on November 16, 2018 (i.e. three months later) by Zabbix developer (not by users) and respective ZBX-15178 has 0 (zero!) votes. If garbage results caused no trouble, then suggested change in the logic won't cause any troubles as well.


Generated at Fri Apr 26 00:39:01 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.