<?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 to get details of endpoint connection time in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258210#M9434</link>
    <description>&lt;P class="isSelectedEnd"&gt;&lt;SPAN&gt;Hello Susekar,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="isSelectedEnd"&gt;&lt;SPAN&gt;Thank you for your reply.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="isSelectedEnd"&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;CODE dir="ltr"&gt;&lt;SPAN&gt;agent_audit_logs&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN&gt; dataset does not exist. Also, when checking the Agent Audit Logs, there are no events with a description containing “Agent connected” or “Agent disconnected.”&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2026 22:20:55 GMT</pubDate>
    <dc:creator>a.martinez578319</dc:creator>
    <dc:date>2026-07-06T22:20:55Z</dc:date>
    <item>
      <title>XQL to get details of endpoint connection time</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258208#M9432</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;
&lt;P&gt;I need to create a report in Cortex XDR to identify endpoint connection activity within a specific time window.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The requirement is not to know when the endpoint was first registered in Cortex, so `first_seen` does not apply here.&lt;/P&gt;
&lt;P&gt;What I need is to identify:&lt;/P&gt;
&lt;P&gt;1. Endpoints that changed from DISCONNECTED to CONNECTED during the selected time window.&lt;BR /&gt;2. The timestamp when that DISCONNECTED-to-CONNECTED transition happened.&lt;BR /&gt;3. Endpoints that were already CONNECTED before the selected time window and are still CONNECTED at the time the query is executed.&lt;BR /&gt;4. For endpoints that were already CONNECTED before the selected time window, I also need to know the original time when they became CONNECTED.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The challenge I am facing is that `last_seen` appears to be continuously updated while the endpoint remains connected. Because of that, if an endpoint connected at 7:00 AM and is still connected at 7:55 AM, `last_seen` may show 7:55 AM instead of the original time when the endpoint became CONNECTED.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;So I am trying to determine whether Cortex XDR stores the actual status transition event, specifically when an endpoint changed from DISCONNECTED to CONNECTED, and whether this can be queried using XQL, Agent Audit Logs, or another built-in dataset.&lt;/P&gt;
&lt;P&gt;In short, I am looking for a way to report both:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;- Endpoints that became CONNECTED during the selected time window, including the time when the transition happened.&lt;BR /&gt;&lt;BR /&gt;- Endpoints that were already CONNECTED before the selected time window and are still CONNECTED when the query runs, including the original time when they became CONNECTED.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2026 20:54:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258208#M9432</guid>
      <dc:creator>a.martinez578319</dc:creator>
      <dc:date>2026-07-06T20:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: XQL to get details of endpoint connection time</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258209#M9433</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/1669334345"&gt;@a.martinez578319&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 class="p8i6j01 paragraph"&gt;Cortex XDR stores agent connection state changes in the &lt;STRONG&gt;Agent Audit Logs&lt;/STRONG&gt;, which can be queried via XQL using the &lt;CODE class="p8i6j0f"&gt;agent_audit_logs&lt;/CODE&gt; dataset. This allows you to identify specific transitions from &lt;STRONG&gt;DISCONNECTED&lt;/STRONG&gt; to &lt;STRONG&gt;CONNECTED&lt;/STRONG&gt; and see the exact timestamp of that event.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;H4 class="_9k2iva0 p8i6j0c _1ibi0s314 heading3 _9k2iva1"&gt;&lt;STRONG&gt;Connection Status Logic in Cortex XDR:&lt;/STRONG&gt;&lt;/H4&gt;
&lt;UL class="p8i6j07 p8i6j02"&gt;
&lt;LI class="p8i6j0a"&gt;&lt;STRONG&gt;Transition Event:&lt;/STRONG&gt; When an agent reconnects, it generates an audit log entry with a specific description (e.g., "Agent connected").&lt;/LI&gt;
&lt;LI class="p8i6j0a"&gt;&lt;STRONG&gt;&lt;CODE class="p8i6j0f"&gt;last_seen&lt;/CODE&gt; vs. Connection Time:&lt;/STRONG&gt; You are correct that &lt;CODE class="p8i6j0f"&gt;last_seen&lt;/CODE&gt; is a heartbeat field that updates continuously while the agent is online. To find the &lt;EM&gt;start&lt;/EM&gt; of the connection, you must look for the &lt;STRONG&gt;Transition Event&lt;/STRONG&gt; in the audit logs.&lt;/LI&gt;
&lt;LI class="p8i6j0a"&gt;&lt;STRONG&gt;Disconnected Thresholds:&lt;/STRONG&gt; By default, an agent is marked "Disconnected" after 10 minutes of silence and "Connection Lost" after 30 days.&lt;BR /&gt;
&lt;H4&gt;&lt;STRONG style="color: inherit; font-family: 'TT Hoves', DecimalMedium, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 20px;"&gt;&lt;BR /&gt;(XQL Query for Connection Reporting)&lt;BR /&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="p8i6j01 paragraph"&gt;To satisfy your specific requirements, you can use the following XQL query logic. It focuses on the &lt;CODE class="p8i6j0f"&gt;agent_audit_logs&lt;/CODE&gt; to capture transitions and the &lt;CODE class="p8i6j0f"&gt;endpoints&lt;/CODE&gt; dataset for current status.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;H4 class="_9k2iva0 p8i6j0c _1ibi0s314 heading4 _9k2iva1"&gt;&lt;STRONG&gt;1. Endpoints that transitioned during the time window&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P class="p8i6j01 paragraph"&gt;This query identifies the exact moment an agent changed from a disconnected state back to connected.&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3en" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-xql p8i6j0e hljs language-xql _12n1b832"&gt;config timeframe &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; $SELECTED_TIME_WINDOW
&lt;SPAN class="hljs-operator"&gt;|&lt;/SPAN&gt; dataset &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; agent_audit_logs
&lt;SPAN class="hljs-operator"&gt;|&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;filter&lt;/SPAN&gt; (description &lt;SPAN class="hljs-keyword"&gt;contains&lt;/SPAN&gt; "Agent connected" &lt;SPAN class="hljs-keyword"&gt;or&lt;/SPAN&gt; description &lt;SPAN class="hljs-keyword"&gt;contains&lt;/SPAN&gt; "successfully connected")
&lt;SPAN class="hljs-operator"&gt;|&lt;/SPAN&gt; fields _time &lt;SPAN class="hljs-keyword"&gt;as&lt;/SPAN&gt; connection_event_time, endpoint_name, endpoint_id, description
&lt;SPAN class="hljs-operator"&gt;|&lt;/SPAN&gt; sort &lt;SPAN class="hljs-keyword"&gt;asc&lt;/SPAN&gt; connection_event_time&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3dp _1ibi0s332 _1ibi0s3eo _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P class="p8i6j01 paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 class="_9k2iva0 p8i6j0c _1ibi0s314 heading4 _9k2iva1"&gt;&lt;STRONG&gt;2. Endpoints already CONNECTED (and their original connection time)&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P class="p8i6j01 paragraph"&gt;Since &lt;CODE class="p8i6j0f"&gt;endpoints&lt;/CODE&gt; only shows the &lt;EM&gt;current&lt;/EM&gt; state, finding the "original" time for endpoints that were already connected requires looking further back in the audit logs. You can join the current inventory with the historical connection events.&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3en" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-xql p8i6j0e hljs language-xql _12n1b832"&gt;&lt;SPAN class="hljs-comment"&gt;// Identify currently connected endpoints and find their EARLIEST 'connected' event&lt;/SPAN&gt;
dataset = endpoints
| filter endpoint_status = &lt;SPAN class="hljs-string"&gt;"CONNECTED"&lt;/SPAN&gt;
| fields endpoint_name, endpoint_id, last_seen
| &lt;SPAN class="hljs-keyword"&gt;join&lt;/SPAN&gt; type = inner (
    dataset = agent_audit_logs
    | filter description contains &lt;SPAN class="hljs-string"&gt;"connected"&lt;/SPAN&gt;
    | &lt;SPAN class="hljs-function"&gt;comp &lt;SPAN class="hljs-title"&gt;min&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;_time&lt;/SPAN&gt;) &lt;SPAN class="hljs-keyword"&gt;as&lt;/SPAN&gt; original_connection_time &lt;SPAN class="hljs-keyword"&gt;by&lt;/SPAN&gt; endpoint_id
) &lt;SPAN class="hljs-keyword"&gt;as&lt;/SPAN&gt; history history.endpoint_id&lt;/SPAN&gt; = endpoint_id
| fields endpoint_name, history.original_connection_time, last_seen&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note on Reporting:&lt;/STRONG&gt; For a comprehensive report, I recommend running the historical audit log query over a wider timeframe (e.g., 30 days) to ensure you capture the "original" connection event for agents that have been online for a long time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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&amp;nbsp;&lt;STRONG&gt;like&amp;nbsp;&lt;/STRONG&gt;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;Thanks &amp;amp; Regards,&lt;BR /&gt;S. Subashkar Sekar&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2026 22:00:23 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258209#M9433</guid>
      <dc:creator>susekar</dc:creator>
      <dc:date>2026-07-06T22:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: XQL to get details of endpoint connection time</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258210#M9434</link>
      <description>&lt;P class="isSelectedEnd"&gt;&lt;SPAN&gt;Hello Susekar,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="isSelectedEnd"&gt;&lt;SPAN&gt;Thank you for your reply.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="isSelectedEnd"&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;CODE dir="ltr"&gt;&lt;SPAN&gt;agent_audit_logs&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN&gt; dataset does not exist. Also, when checking the Agent Audit Logs, there are no events with a description containing “Agent connected” or “Agent disconnected.”&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2026 22:20:55 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-to-get-details-of-endpoint-connection-time/m-p/1258210#M9434</guid>
      <dc:creator>a.martinez578319</dc:creator>
      <dc:date>2026-07-06T22:20:55Z</dc:date>
    </item>
  </channel>
</rss>

