29 Oct 2024
	
		
		04:48 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		29 Oct 2024
	
		
		07:25 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		
		
			MaciejNeumann
		
		
		
		
		
		
		
		
	
			
		
Hello, Dynatrace Community!
I’m working with Gen3 DQL and trying to filter events based on a specific management zone, specifically for the “xxxx” management zone. I attempted the query in Gen3, and I’m attaching a screenshot of my code for reference.
However, I’ve noticed a discrepancy: when I apply the management zone filter in the older DQL version, the results differ from what I’m getting in Gen3 DQL. This leads to the following questions:
1. What is the correct DQL syntax for Gen3 dashboards to properly filter by management zone?
2. How should I modify my query to ensure that only events associated with the “xxx” management zone are displayed?
fetch events
| filter event.kind == "DAVIS_PROBLEM"
| sort timestamp desc
| lookup [ 
      fetch dt.entity.host
      | expand managementZones
    ], sourceField:effected_entity_ids, lookupField:id, prefix:"mzone."
| summarize {status = takeFirst(event.status),
            event.name = takeFirst(event.name),
            severityLevel = takeFirst(event.category),
            managmentzone = takeFirst(affected_entities.management_zones.names
          ),
            affected = takeFirst(affected_entity_ids)},
            by:{display_id}
| fieldsAdd Status = if((status == "ACTIVE")," OPEN",
                  else:if((status == "CLOSED"),"🟢 CLOSED"))
| fields Status, display_id, event.name,affected, severityLevel, managmentzone
Thank you for your help!
ahmed alrahbi 😊
Solved! Go to Solution.
14 Jan 2025 01:09 PM
Hello @Ahmedrahbi,
Could you check out this reply in another thread from @sinisa_zubic?
Fetch active problems 
You'll find the answer there on how to fetch and filter out events in the query, which may help with your use case
14 Jan 2025 02:00 PM
Hi @Ahmedrahbi
To filter data in Dashboards you should use segments . Please not that the feature is currently "In Preview" and there might be still changes happening to the feature.
Best,
Sini
11 Feb 2025 11:12 PM
But how do you filter events by management zone? I can't find that documented anywhere and I see a lot of folks with the question.