<?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: XQL query to get a list of current applications installed on hosts in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-get-a-list-of-current-applications-installed-on/m-p/1246478#M9052</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/896010941"&gt;@K.Dadana633909&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings for the day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue of duplicate host/application sets in your results occurs because the &lt;CODE&gt;host_inventory&lt;/CODE&gt; dataset is a log-based, point-in-time dataset. Unlike the standard &lt;CODE&gt;endpoints&lt;/CODE&gt; dataset, which generally reflects the current state, &lt;CODE&gt;host_inventory&lt;/CODE&gt; stores historical records of every inventory scan (which occurs by default every 24 hours). Without a deduplication stage, your query returns every historical application scan ever reported for each host in the specified timeframe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To resolve this and ensure you are only seeing the most recent application data, follow these steps:&lt;/P&gt;
&lt;H4&gt;1. Apply Deduplication to the host_inventory Dataset&lt;/H4&gt;
&lt;P&gt;You must use the &lt;CODE&gt;dedup&lt;/CODE&gt; stage to isolate the most recent scan for each host. It is most efficient to perform this deduplication before the &lt;CODE&gt;arrayexpand&lt;/CODE&gt; and &lt;CODE&gt;join&lt;/CODE&gt; stages to reduce the number of rows processed.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Recommended deduplication logic:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-xql"&gt;dataset = host_inventory
| dedup host_name by desc _time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This ensures you only process the single latest inventory report for each hostname. If your environment has hosts with duplicate names, deduplicate by &lt;CODE&gt;agent_id&lt;/CODE&gt; or &lt;CODE&gt;serial_number&lt;/CODE&gt; instead.&lt;/P&gt;
&lt;H4&gt;2. Use the host_inventory_applications Preset&lt;/H4&gt;
&lt;P&gt;For application-specific queries, using the dedicated preset is often more efficient and is the recommended approach for software inventory reports. This preset is optimized for application data and reduces the need for manual JSON extraction from the &lt;CODE&gt;applications&lt;/CODE&gt; field.&lt;/P&gt;
&lt;H4&gt;3. Verify Version and Known Bugs&lt;/H4&gt;
&lt;P&gt;If you are running Cortex XDR/XSIAM version 3.16, be aware of a known bug (CRTX-209483) that specifically caused the &lt;CODE&gt;host_inventory&lt;/CODE&gt; dataset to return massive amounts of duplicate historical data regardless of filters. Ensure your tenant has received the latest backend hotfixes to address this.&lt;/P&gt;
&lt;H4&gt;Optimized XQL Query Example&lt;/H4&gt;
&lt;P&gt;Based on your original query, here is an optimized version that incorporates deduplication and performance best practices:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-xql"&gt;// Set a specific timeframe to avoid scanning unnecessary historical logs
config timeframe = 7d 
| dataset = host_inventory
// 1. Get the latest scan per host before expanding applications
| dedup host_name by desc _time 
| filter applications != null
| arrayexpand applications
| alter 
    applications = json_extract(applications, "$.application_name"), 
    software_vendor = json_extract(applications, "$.vendor"), 
    software_version = json_extract(applications, "$.version")
// 2. Join with deduped endpoints to ensure one-to-one mapping
| join (dataset = endpoints | dedup endpoint_name) as EP EP.endpoint_name = host_name
| fields host_name, applications, software_version, group_names
| arrayexpand group_names limit 1
| sort asc group_names
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you feel this has answered your query, please let us know by clicking like and on&amp;nbsp;&lt;STRONG&gt;"mark this as a Solution".&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy New year!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;S. Subashkar Sekar&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2026 22:12:54 GMT</pubDate>
    <dc:creator>susekar</dc:creator>
    <dc:date>2026-01-23T22:12:54Z</dc:date>
    <item>
      <title>XQL query to get a list of current applications installed on hosts</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-get-a-list-of-current-applications-installed-on/m-p/1246477#M9051</link>
      <description>&lt;DIV class="mb-9 ng-tns-c3958128634-105 ng-trigger ng-trigger-messageAnim c-chat-message c-chat-message--user flex items-start ng-star-inserted" dir="ltr"&gt;
&lt;DIV class="c-chat-message__inner ng-tns-c3958128634-105"&gt;
&lt;DIV class="c-chat-message__content ng-tns-c3958128634-105"&gt;
&lt;DIV class="break-words text-sm leading-6.5 ng-tns-c3958128634-105 ng-star-inserted"&gt;
&lt;DIV class="ng-tns-c3958128634-105"&gt;
&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Our team is trying to utilize the XDR host inventory dataset to gather details on what applications are installed on each host.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We’re encountering an issue with Cortex XDR Host Inventory queries returning stale host data, which is producing duplicate host/application sets in our results. Is anyone aware of how we can resolve this issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The current XQL we are utilizing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset = host_inventory&lt;/P&gt;
&lt;P&gt;| filter applications != null&lt;/P&gt;
&lt;P&gt;| arrayexpand applications&lt;/P&gt;
&lt;P&gt;| alter applications=json_extract(applications, "$.application_name"), software_vendor = json_extract(applications, "$.vendor"), software_verion = json_extract(applications, "$.version")&lt;/P&gt;
&lt;P&gt;| join (dataset = endpoints) as EP EP.endpoint_name = host_name&lt;/P&gt;
&lt;P&gt;| fields host_name, applications, software_verion, group_names&lt;/P&gt;
&lt;P&gt;| arrayexpand group_names limit 1&lt;/P&gt;
&lt;P&gt;| sort asc group_names&lt;/P&gt;
&lt;P&gt;//| comp count(applications) by host_name&lt;/P&gt;
&lt;P&gt;// | dedup applications by desc host_name (optional)&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="c-chat-message__actions ng-tns-c3958128634-105"&gt;
&lt;DIV class="ng-star-inserted"&gt;
&lt;DIV class="ng-star-inserted"&gt;
&lt;DIV class="flex justify-between ng-star-inserted"&gt;
&lt;DIV&gt;
&lt;DIV class="mat-mdc-tooltip-trigger inline-block ng-star-inserted" aria-describedby="cdk-describedby-message-ng-1-33"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;BUTTON class="mat-mdc-tooltip-trigger mat-secondary mat-sm !mr-1 mdc-button mat-mdc-button mat-unthemed mat-mdc-button-base ng-star-inserted" aria-describedby="cdk-describedby-message-ng-1-34"&gt;&lt;/BUTTON&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="mb-9 ng-tns-c3958128634-107 pb-6 ng-trigger ng-trigger-messageAnim c-chat-message flex items-start ng-star-inserted" dir="ltr"&gt;
&lt;DIV class="c-chat-message__inner ng-tns-c3958128634-107"&gt;
&lt;DIV class="c-chat-message__content ng-tns-c3958128634-107"&gt;
&lt;DIV class="break-words text-sm leading-6.5 ng-tns-c3958128634-107 ng-star-inserted"&gt;
&lt;DIV class="ng-star-inserted"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 23 Jan 2026 21:46:03 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-get-a-list-of-current-applications-installed-on/m-p/1246477#M9051</guid>
      <dc:creator>K.Dadana633909</dc:creator>
      <dc:date>2026-01-23T21:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: XQL query to get a list of current applications installed on hosts</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-get-a-list-of-current-applications-installed-on/m-p/1246478#M9052</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/896010941"&gt;@K.Dadana633909&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings for the day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue of duplicate host/application sets in your results occurs because the &lt;CODE&gt;host_inventory&lt;/CODE&gt; dataset is a log-based, point-in-time dataset. Unlike the standard &lt;CODE&gt;endpoints&lt;/CODE&gt; dataset, which generally reflects the current state, &lt;CODE&gt;host_inventory&lt;/CODE&gt; stores historical records of every inventory scan (which occurs by default every 24 hours). Without a deduplication stage, your query returns every historical application scan ever reported for each host in the specified timeframe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To resolve this and ensure you are only seeing the most recent application data, follow these steps:&lt;/P&gt;
&lt;H4&gt;1. Apply Deduplication to the host_inventory Dataset&lt;/H4&gt;
&lt;P&gt;You must use the &lt;CODE&gt;dedup&lt;/CODE&gt; stage to isolate the most recent scan for each host. It is most efficient to perform this deduplication before the &lt;CODE&gt;arrayexpand&lt;/CODE&gt; and &lt;CODE&gt;join&lt;/CODE&gt; stages to reduce the number of rows processed.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Recommended deduplication logic:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-xql"&gt;dataset = host_inventory
| dedup host_name by desc _time
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This ensures you only process the single latest inventory report for each hostname. If your environment has hosts with duplicate names, deduplicate by &lt;CODE&gt;agent_id&lt;/CODE&gt; or &lt;CODE&gt;serial_number&lt;/CODE&gt; instead.&lt;/P&gt;
&lt;H4&gt;2. Use the host_inventory_applications Preset&lt;/H4&gt;
&lt;P&gt;For application-specific queries, using the dedicated preset is often more efficient and is the recommended approach for software inventory reports. This preset is optimized for application data and reduces the need for manual JSON extraction from the &lt;CODE&gt;applications&lt;/CODE&gt; field.&lt;/P&gt;
&lt;H4&gt;3. Verify Version and Known Bugs&lt;/H4&gt;
&lt;P&gt;If you are running Cortex XDR/XSIAM version 3.16, be aware of a known bug (CRTX-209483) that specifically caused the &lt;CODE&gt;host_inventory&lt;/CODE&gt; dataset to return massive amounts of duplicate historical data regardless of filters. Ensure your tenant has received the latest backend hotfixes to address this.&lt;/P&gt;
&lt;H4&gt;Optimized XQL Query Example&lt;/H4&gt;
&lt;P&gt;Based on your original query, here is an optimized version that incorporates deduplication and performance best practices:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-xql"&gt;// Set a specific timeframe to avoid scanning unnecessary historical logs
config timeframe = 7d 
| dataset = host_inventory
// 1. Get the latest scan per host before expanding applications
| dedup host_name by desc _time 
| filter applications != null
| arrayexpand applications
| alter 
    applications = json_extract(applications, "$.application_name"), 
    software_vendor = json_extract(applications, "$.vendor"), 
    software_version = json_extract(applications, "$.version")
// 2. Join with deduped endpoints to ensure one-to-one mapping
| join (dataset = endpoints | dedup endpoint_name) as EP EP.endpoint_name = host_name
| fields host_name, applications, software_version, group_names
| arrayexpand group_names limit 1
| sort asc group_names
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you feel this has answered your query, please let us know by clicking like and on&amp;nbsp;&lt;STRONG&gt;"mark this as a Solution".&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy New year!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;S. Subashkar Sekar&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2026 22:12:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-query-to-get-a-list-of-current-applications-installed-on/m-p/1246478#M9052</guid>
      <dc:creator>susekar</dc:creator>
      <dc:date>2026-01-23T22:12:54Z</dc:date>
    </item>
  </channel>
</rss>

