[ZBX-7792] Document "like" operator in count function Created: 2014 Feb 12  Updated: 2017 May 30  Resolved: 2016 Jan 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: 2.2.2
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Dmitry Samsonov Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: count
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

As mentioned in ZBX-2039, operator "like" in function count work as "like" in sql.
It means, that you can use % for wildcard (and it matches newlines) and it also means, that argument may be treated as case-sensitive or case-insensitive dependent on database.

Please add this info to the documentation.
Thank you.



 Comments   
Comment by Martins Valkovskis [ 2015 Apr 10 ]

Apparently, according to Zabbix developers, this is not true. "like" looks for a case-sensitive substring match only.

Comment by Dmitry Samsonov [ 2015 Apr 16 ]

I don't see anything about "% for wildcard" in current documentation.
Could you please add it?
Thank you.

Comment by Aleksandrs Saveljevs [ 2016 Jan 21 ]

In ZBX-2039, it is not mentioned that "like" in count() works the same as "like" in SQL. On the contrary, there was a bug, where we did not escape % and _ in "like" patterns when performing SQL queries.

Function evaluation has changed a lot since then (in particular, the introduction of value cache) and we no longer do direct SQL queries. Now, we just do the following:

switch (op)
{
	...
	case OP_LIKE:
		if (NULL != strstr(value->str, arg2))
			return SUCCEED;
		break;
}

So it is a simple case-sensitive substring search without any wildcard characters.

Comment by Dmitry Samsonov [ 2016 Jan 21 ]

So, previously we didn't have regex in count function, now we don't even have simple wildcard. It's a pity.

Comment by Marc [ 2016 Jan 21 ]

For the record, ZBXNEXT-1250 is requesting count() filter by regexp.

Generated at Sat Aug 02 09:20:04 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.