Filter Data by Tags in Dynatrace Query Language (DQL)

Summary: This thread explains how to filter data using tags in DQL queries. It includes syntax examples and practical tips for refining dashboards and reports in Dynatrace.

How to filter by tags in DQL?

This gives many hosts but I’d like to filter by the different tags I see.

fetch dt.entity.host<br>| fieldsAdd entity.type, lifetime, tags, softwareTechnologies, osType, hypervisorType, state, kubernetesLabels,<br> cpuCores, memoryTotal, boshName, gcpZone, awsNameTag, oneAgentCustomHostName, azureResourceGroupName, dnsNames,<br> ipAddress, osVersion, installerVersion, osArchitecture, bitness, gceInstanceId, boshAvailabilityZone, gceProjectId,<br> boshInstanceId, boshInstanceName, gceInstanceName, gceHostName, boshStemcellVersion, zosSystemName, zosLparName,<br> osServices, paasVendorType, cloudType, networkZone, gceNumericProjectId, azureEnvironment, azureComputeModeName,<br> zosVirtualization, azureSiteNames, zosCPUSerialNumber, cloudPlatformVendorVersion, azureHostNames, gceMachineType,<br> azureVmSizeLabel, monitoringMode, standalone, autoInjection, azureVmScaleSetName, installerSupportAlert,<br> zosCPUModelNumber, azureZone, boshDeploymentId, installerPotentialProblem, logicalCpus, physicalMemory,<br> customHostMetadata, standaloneSpecialAgentsOnly, additionalSystemInfo, logicalCpuCores, zosTotalPhysicalMemory,<br> zosTotalGeneralPurposeProcessors, virtualCpus, gcePublicIpAddresses, isMonitoringCandidate, zosTotalZiipProcessors,<br> installerTrackedDownload, macAddresses, simultaneousMultithreading, paasMemoryLimit, azureSku
"records": [{<br>  "id": "HOST-123456789",<br>  "entity.name": "xxxxxx",<br>  "entity.type": "HOST",<br>  "lifetime": {<br>    "start": "2022-07-21T12:45:55.198Z",<br>    "end": "2023-05-11T18:21:20.728Z"<br>  },<br>  "tags": [<br>  "TG.ProcessGroup.DetectedName:Oracle Listeners",<br>  "TG.App.Env:testing"<br>  ]<br>}, ...<br>]<br><br>
fetch dt.entity.host<br>| fieldsAdd entity.type, lifetime, tags<br>| filter contains(tags,"abc") - this fails

Try this:

fetch dt.entity.host<br>| fieldsAdd entity.type, lifetime, tags<br>| filter matchesValue(tags,"abc")