[ZBX-18432] Tag filter with empty name and value does not show problems without tags Created: 2020 Sep 30  Updated: 2025 Mar 24  Resolved: 2025 Feb 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 5.0.3
Fix Version/s: 6.0.39rc1, 7.0.10rc1, 7.2.4rc1, 7.4.0alpha1

Type: Problem report Priority: Major
Reporter: Christian Anton Assignee: Deniels Pankins
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: 2h
Original Estimate: Not Specified
Environment:

Ubuntu


Attachments: PNG File 01_all_problems.png     PNG File 02_group_permissions.png     PNG File 03_group_tag_filter.png     PNG File 04_problems_seen_by_limited_user.png     PNG File 05_tag_filters_all_tags.png     PNG File 06_user_sees_all_problems.png     PNG File 2020-10-01_08-47-13.png     PNG File screenshot-1.png     PNG File screenshot-2.png    
Issue Links:
Duplicate
is duplicated by ZBX-25909 When applying a tag filter with an em... Closed
Team: Team C
Sprint: S25-W6/7, S25-W8/9
Story Points: 0.5

 Description   

Steps to reproduce:

  1. Make sure to have some problems on hosts assigned to specific host groups
  2. Set up a user with Admin or User type
  3. Set permissions to see contents of at least one group, better two
  4. Set Tag Filter for one of these groups, with both "Tag Name" and "Tag Value" empty

Result:
Problems which have no tags assigned with them are not shown. Only those that actually have any tag.

In the documentation (https://www.zabbix.com/documentation/current/manual/config/users_and_usergroups/usergroup), it's stated in another way, which also makes more sense as the behavior that currently takes place:

If both tag name and value fields are left blank but host group selected, corresponding user group will see all problems for selected host group

Expected:
As the documentation states, ALL problems from corresponding groups should be visible for user.



 Comments   
Comment by Andrei Gushchin (Inactive) [ 2020 Oct 01 ]

Hello Christian,

I cannot reproduce that. I've created user group with permissions to two hostgroups one read second write, and tags as you mentioned without any value.
And I can see all problems with and without tags.
Maybe you have some filter enabled in the problem page or dashboard?

Comment by Andrei Gushchin (Inactive) [ 2020 Oct 01 ]



And user see all problems fine

Comment by Christian Anton [ 2020 Oct 06 ]

I can confirm it works fine if you have "all tags" tag filter permissions for both groups. In my case, I was testing with tag filter permissions with a defined tag name (or tag name AND tag value) for one of the groups, and "all tags" for the other group. In such case, the user will only see those problems either matching the defined tag filter that haves at least a tag name defined or, for the other group, those that have ANY tag defined, but not those without tags.

Check the following screenshots:

01: Here you see all problems currently existing, viewed as Super Admin. Spread over two host groups, two of the three problems have tags defined, one not.

02: Permissions for the group where one user is in, read write permissions for both groups:

03: tag filters for this user group: "all tags" for one group, "defined tag name" for the other group:

04: problems seen by the user being part of that group: missing the problem which has no tag defined:

05: changing the tag filters to be as in your example, both set to "all tags" (which in fact is useless, because it is the same as actually not defining any tag filters at all):

06: now the user sees all three problems

 

The use case we want to achieve is:

  1. see ALL problems for a certain list of groups (those you are responsible for)
  2. see SPECIFIC problems, filtered by tags, for some other groups (where you are only responsible for specific parts of functionality)
Comment by Christian Anton [ 2020 Oct 08 ]

+++++

Does the above explanation help you to reproduce the bug?

Comment by Christian Anton [ 2020 Nov 04 ]

could someone please look into this? This issue is still in "needs info" even though I have supplied exact info on 6th of October!

Comment by Alexander Vladishev [ 2025 Feb 11 ]

This happens due to an incorrect condition in the SQL query when there is a combination of a tag filter with specified tags and without them.

In this case, a JOIN is performed with the "problem_tag" table, which contains no records for events without tags.

Replacing the condition with a LEFT JOIN should resolve the issue.

  SELECT DISTINCT p.eventid,p.objectid,p.clock,p.ns,p.name,p.severity,p.cause_eventid
- FROM problem p,functions f,items i,host_hgset hh,permission pp,hosts_groups hg,problem_tag pt
+ FROM problem p LEFT JOIN problem_tag pt WHERE p.eventid=pt.eventid,functions f,items i,host_hgset hh,permission pp,hosts_groups hg
  WHERE p.source=0
      AND p.object=0
      AND p.objectid=f.triggerid
      AND f.itemid=i.itemid
      AND i.hostid=hh.hostid
      AND hh.hgsetid=pp.hgsetid
      AND pp.ugsetid=2
      AND NOT EXISTS (
          SELECT NULL
          FROM functions f1
              JOIN items i1 ON f1.itemid=i1.itemid
              JOIN host_hgset hh1 ON i1.hostid=hh1.hostid
              LEFT JOIN permission pp1 ON hh1.hgsetid=pp1.hgsetid AND pp1.ugsetid=pp.ugsetid
          WHERE p.objectid=f1.triggerid
              AND pp1.permission IS NULL
      )
      AND i.hostid=hg.hostid
-     AND p.eventid=pt.eventid
      AND ((hg.groupid='2' AND pt.tag='component' AND pt.value='system') OR hg.groupid=4)
      AND NOT EXISTS (
          SELECT NULL FROM event_suppress es WHERE es.eventid=p.eventid
      )
      AND p.cause_eventid IS  NULL
      AND (p.r_eventid IS NULL OR p.r_clock>1739257010)
      ORDER BY p.eventid DESC LIMIT 1001
Comment by Alexander Vladishev [ 2025 Feb 11 ]

This issue has been forwarded to the development team.

Generated at Fri May 02 08:34:54 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.