<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DLQ Filter events or timeseries by comparing contents of array fields in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273630#M1865</link>
    <description>&lt;P&gt;OK.&amp;nbsp; Weird ... .setting the variable on the dashboard to multiselect seems to fix my last attempt there...&lt;/P&gt;</description>
    <pubDate>Wed, 26 Mar 2025 20:50:45 GMT</pubDate>
    <dc:creator>Landho</dc:creator>
    <dc:date>2025-03-26T20:50:45Z</dc:date>
    <item>
      <title>Filter Events or Time-Series by Array Contents Using DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273202#M1841</link>
      <description>&lt;P&gt;Hello - new to DT and just deploying it.&amp;nbsp; So far I am struggling to fully mature my DQL savvy - so this question is my first.&lt;/P&gt;
&lt;P&gt;I'm trying to setup dashboard filters to filer by Data Center.&amp;nbsp; &amp;nbsp;I already have the dashboard variable generate a dropdown of available data centers:&lt;/P&gt;
&lt;P&gt;Drop down to select $Data_Center, this is a friendly list of geoloc_site which shows the entitiy name.&lt;/P&gt;
&lt;P class="lia-align-left lia-indent-padding-left-60px"&gt;fetch dt.entity.geoloc_site&lt;BR /&gt;| expand managementZones&lt;BR /&gt;| dedup entity.name&lt;BR /&gt;| fields entity.name&lt;/P&gt;
&lt;P&gt;The selection from the dropdown assigns the $geoloc_siteID as the "id" field of the data center, which is then used within DQL tiles in the dashboard.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;fetch dt.entity.geoloc_site&lt;BR /&gt;| expand managementZones&lt;BR /&gt;| filter entity.name == $Data_Center&lt;BR /&gt;| dedup entity.name&lt;BR /&gt;| fields id&lt;/P&gt;
&lt;P&gt;This works very well when querying dt.entity.host for things:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;fetch dt.entity.host&lt;BR /&gt;| filterOut isMonitoringCandidate == true&lt;BR /&gt;| filter belongs_to[dt.entity.geoloc_site] == $geoloc_siteID&lt;BR /&gt;| summarize count(), alias: hosts&lt;/P&gt;
&lt;P&gt;However - I am struggling to figure out the syntax or most effective/efficient DQL to filter timeseries or events (or other tables) using the array fields which contain the host id's.&lt;/P&gt;
&lt;P&gt;I can get the hosts which are part of a geoloc_site as:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;fetch dt.entity.geoloc_site | fieldsAdd contains[dt.entity.host]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or get the geoloc_site from the dt.entity.host directly as (statically assigned geoloc-site in the example below)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;fetch dt.entity.host&lt;BR /&gt;| filter matchesValue(belongs_to[dt.entity.geoloc_site], "GEOLOC_SITE-173D0FB9BA7EB97B")&lt;BR /&gt;| fields id&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Where I am struggling is to compare the array fields to use in&amp;nbsp; filters - like this events&amp;nbsp; - I'd like to filter the events by hosts which are part of a specific geoloc_site... in this example below - i'd like to filter the events such that hosts ID's in affected_entity_ids related_entity_id array fields are also in the geoloc_site (by filter on where array contents in&amp;nbsp;fetch dt.entity.geoloc_site | fieldsAdd contains[dt.entity.host]??)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What I am struggling to figure out is how to compare / filter array field in timeseries or events or other table based on the contents of the geoloc_site array field contents or the dt.entity.host array field of similar.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;fetch events, from: toTimestamp("2025-02-28T19:37:00.000Z")-6h-10m, to: toTimestamp("2025-02-28T19:37:00.000Z")&lt;BR /&gt;| filter dt.system.bucket == "default_davis_events"&lt;BR /&gt;| filter event.kind == "DAVIS_PROBLEM"&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;// filter here also where any hostid within affected_entity_ids or related_entity_ids is part of geoloc_site???&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;| filter contains(toString(affected_entity_ids),"HOST") or contains(toString(related_entity_ids),"HOST")&lt;BR /&gt;| sort timestamp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ANY suggestions to join or otherwise filter where affected_entity_id's or related_entity_ids are in geohost_site or similar?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 12:17:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273202#M1841</guid>
      <dc:creator>Landho</dc:creator>
      <dc:date>2025-12-18T12:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: DLQ Filter events or timeseries by comparing contents of array fields</title>
      <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273209#M1842</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If I understand correctly, you want to have Davis events by geolocation site?&lt;/P&gt;&lt;P&gt;I think you should use the lookup function to make 2 queries in one.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/correlation-and-join-commands#lookup" target="_blank"&gt;https://docs.dynatrace.com/docs/shortlink/correlation-and-join-commands#lookup&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You should take inspiration from ‘Example 2: Nested field as join condition’.&lt;/P&gt;&lt;P&gt;And add something like this to the end of your DQL&lt;/P&gt;&lt;P&gt;| lookup [fetch dt.entity.geoloc_site], sourceField:host, lookupField:entity.name, fields:{id}&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 15:57:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273209#M1842</guid>
      <dc:creator>Etienne1</dc:creator>
      <dc:date>2025-03-21T15:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: DLQ Filter events or timeseries by comparing contents of array fields</title>
      <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273215#M1843</link>
      <description>&lt;P&gt;I've looked at joins - thinking this would be more efficient than lookups - and attempted them thoroughly.&amp;nbsp; The documentation of them and DQL in general is a bit thin, and Davis Copilot is no help.&amp;nbsp; The examples are not even using real schema examples.&amp;nbsp; I have not stubled across an example or write up on how to&amp;nbsp;compare contents of arrays with another field in a join (nor lookup)&lt;/P&gt;&lt;P&gt;Where I struggle with the join specifically is that I'm attempted to join two array fields within events which contain hosts id's...&amp;nbsp; so, where is the example to interpret array field contents (affected_entity_ids and related_entitiy_ids) on the host_id which is part of the geoloc_site?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Mar 2025 16:21:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273215#M1843</guid>
      <dc:creator>Landho</dc:creator>
      <dc:date>2025-03-21T16:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: DLQ Filter events or timeseries by comparing contents of array fields</title>
      <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273629#M1864</link>
      <description>&lt;P&gt;I'm still stumped on this... certainly I can't be the only person out there attempting to filter events (or other things) based on the data center the host is in?&lt;/P&gt;&lt;P&gt;Simplifying this greatly to try and decipher:&lt;/P&gt;&lt;P&gt;fetch events&lt;BR /&gt;| filter dt.system.bucket == "default_davis_events"&lt;BR /&gt;| filter event.kind == "DAVIS_PROBLEM"&lt;BR /&gt;| filter contains(toString(affected_entity_ids),"HOST") or contains(toString(related_entity_ids),"HOST")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//attempting a lookup but the geoloc_site list of hosts is in contains[dt.entity.host] and it doesn't appear the lookup can compare the hostID as being "in" that array&lt;BR /&gt;&amp;nbsp;| lookup [fetch dt.entity.geoloc_site ],sourceField:dt.entity.host, lookupField:contains[dt.entity.host], fields: {dt.entity.hosts = contains[dt.entity.host]}&lt;/P&gt;&lt;P&gt;Above - I want to filter on the geoloc_site based on where the host ID is within the contains of geoloc_site - the above produces message "&lt;SPAN&gt;Expression not yet implemented (only root-level fields)."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Likewise - if I attempt fieldsadd (to simply add geoloc_site id to the events results, and then later in the query filter on that) - but syntax isn't happy.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//attempting fieldsadd&lt;BR /&gt;&amp;nbsp;| fieldsAdd geoloc_siteID = (fetch dt.entity.geoloc_site&lt;BR /&gt;&amp;nbsp;| fieldsAdd contains[dt.entity.host]&lt;BR /&gt;&amp;nbsp;| filter in(dt.entity.host,`contains[dt.entity.host]`)&lt;BR /&gt;&amp;nbsp;| fields id)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I had another idea to create an array via a variable at the top of the dashboard ... variable named thisDChosts, populated via query - this works, and produces a nice array full of hosts within the DC for the dashboard, but the filter syntax I've not sorted yet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//query to populate the array in the dashboard&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;fetch dt.entity.geoloc_site&lt;BR /&gt;| filter id == $geoloc_siteID&lt;BR /&gt;| fieldsAdd contains[dt.entity.host]&lt;BR /&gt;| fields `contains[dt.entity.host]`, alias: thisDChosts&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and - my attempt to filter events on that ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;fetch events&lt;BR /&gt;| filter dt.system.bucket == "default_davis_events"&lt;BR /&gt;| filter event.kind == "DAVIS_PROBLEM"&lt;BR /&gt;| filter contains(toString(affected_entity_ids),"HOST") or contains(toString(related_entity_ids),"HOST")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| filter in(dt.entity.host, Array($thisDChosts))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The above with filtering the array always results in nothing, even when I know there are hosts with problems in that data center which are in the dashboard variable array&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 20:42:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273629#M1864</guid>
      <dc:creator>Landho</dc:creator>
      <dc:date>2025-03-26T20:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: DLQ Filter events or timeseries by comparing contents of array fields</title>
      <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273630#M1865</link>
      <description>&lt;P&gt;OK.&amp;nbsp; Weird ... .setting the variable on the dashboard to multiselect seems to fix my last attempt there...&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 20:50:45 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273630#M1865</guid>
      <dc:creator>Landho</dc:creator>
      <dc:date>2025-03-26T20:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: DLQ Filter events or timeseries by comparing contents of array fields</title>
      <link>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273641#M1866</link>
      <description>&lt;P&gt;I updated the query to generate the array variable of hosts within the dashboard to below as this seems to run quicker (no idea why) than the above query which does&amp;nbsp;&lt;SPAN&gt;fetch dt.entity.geoloc_site with filters&lt;/SPAN&gt; , however&amp;nbsp; -due to very large amount of hosts within data centers, seem to have hit a limit on variables in dashboards - going to hit our DT support queue for that one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fetch dt.entity.host&lt;BR /&gt;| filter matchesValue(belongs_to[dt.entity.geoloc_site], $geoloc_siteID)&lt;BR /&gt;| fields id&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 04:16:14 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Filter-Events-or-Time-Series-by-Array-Contents-Using-DQL/m-p/273641#M1866</guid>
      <dc:creator>Landho</dc:creator>
      <dc:date>2025-03-27T04:16:14Z</dc:date>
    </item>
  </channel>
</rss>

