[ZBX-15581] Using LDD macros in preprocessing with regex not espace slash. Created: 2019 Feb 04  Updated: 2019 Feb 04  Resolved: 2019 Feb 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: None
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Rodrigo Leme Nunes Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: GIF File 1 - Discovery.gif     GIF File 2 - itemprototype.gif     GIF File 2.1 - itemprototypepreprocessing.gif     GIF File 3 - Itemdiscovered.gif     GIF File 4 - macroconvert-original.gif     GIF File 5 - macroconvert-modified.gif    

 Description   

Using LDD macros in preprocessing with regex not espace slash.
Print "4 - macroconvert-original.gif"

changing file:
src/libs/zbxregexp/zbxregexp.c

Line 952   Add     case '/':
Line 1002  Add    case '/':

Print "5 - macroconvert-modified.gif"

 

 



 Comments   
Comment by Rodrigo Leme Nunes [ 2019 Feb 04 ]

Version: Zabbix 4.0.3

Comment by Glebs Ivanovskis [ 2019 Feb 04 ]

Why should it be escaped? Forward slash is not among PCRE special characters. It is, however, often used as a delimiter (e.g. in PHP code) and delimiter needs to be escaped, but when you can pass your pattern to PCRE directly (like Zabbix does) delimiters are not required.

Comment by Rodrigo Leme Nunes [ 2019 Feb 04 ]

In this case the / is not valid part of expression:

Example:

Regular Expression:

"USER I/O".?"{#WAIT}":"([^"])

Json:

{ "data":[ {"{#FILTRO}":"1","{#EVENTO}":"USER I/O","{#WAIT}":"12.57"}]}

Does not work.

Now escape /

"USER I\/O".?"{#WAIT}":"([^"])

Result :  12.57

The test above can be reproduce in https://regex101.com/

 

 

 

 

Comment by Glebs Ivanovskis [ 2019 Feb 04 ]

https://regex101.com/ is one of the places where delimiters are present, but you can choose them from several options, have a look - pattern without escaping "/" works like a charm when you change delimiters. There are online regexp testers that don't have delimiters exposed, see this.

Comment by Rodrigo Leme Nunes [ 2019 Feb 04 ]

Thanks.

Comment by Rodrigo Leme Nunes [ 2019 Feb 04 ]

It is not system issue.

Generated at Thu Apr 25 17:32:28 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.