<?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 How to get all users that haven't logged in in the past 30 days. in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239322#M8770</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/1618025261"&gt;@W.Edmeades&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;XQL queries can get quite complex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im gonna offer a different approach to solve this using the API get-users&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs-cortex.paloaltonetworks.com/r/Cortex-Platform-APIs/Get-Users?contentId=I7Cjp0wJsX6rWft4dVRPuQ" target="_blank"&gt;https://docs-cortex.paloaltonetworks.com/r/Cortex-Platform-APIs/Get-Users?contentId=I7Cjp0wJsX6rWft4dVRPuQ&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can get the&amp;nbsp;&lt;BR /&gt;last_logged_in type of data is integer = Timestamp of when the user last logged in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the appropriate logic in your script it should be possible to get the data your are looking for.&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 like and on "mark this as a Solution".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;KR,&lt;/P&gt;
&lt;P&gt;Luis&lt;/P&gt;</description>
    <pubDate>Thu, 02 Oct 2025 20:54:35 GMT</pubDate>
    <dc:creator>eluis</dc:creator>
    <dc:date>2025-10-02T20:54:35Z</dc:date>
    <item>
      <title>XQL How to get all users that haven't logged in in the past 30 days.</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239051#M8759</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm having trouble putting together a query that'll grab me a list of users that haven't logged in within the past 30 days.&lt;/P&gt;
&lt;P&gt;So far I've got this, but I'm not even sure if it's the right approach, so I'm just a bit stuck:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset = xdr_data // Using the xdr dataset
 | filter event_type = ENUM.EVENT_LOG and action_evtlog_event_id = 4624 // Filtering by windows event log and id 4624
 | alter User_Name = arrayindex(regextract(action_evtlog_message,"New Logon:\r\n.*\r\n.*?Account Name:.*?(\w.*?)\r\n"),0) // Using regextract to get just a part of the full event log message into an array, then using arrayindex to take the first item in the array
 | fields User_Name // Select all the fields to show them

| alter lastLoginEpoch = //"last Seen" column value for user
| filter lastLoginEpoch &amp;lt; to_timestamp(add(to_epoch(date_floor(current_time(),"d")),-2592000))&lt;/LI-CODE&gt;
&lt;P&gt;It should theoretically be possible, I just need to grab:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;a list of login timestamps for all users&lt;/LI&gt;
&lt;LI&gt;select the most recent one for each user&lt;/LI&gt;
&lt;LI&gt;remove all users who have logged in between "now" &amp;amp; 30 days ago.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Just not sure how to do any of that, even after consulting the documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would greatly be appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 02:38:41 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239051#M8759</guid>
      <dc:creator>W.Edmeades</dc:creator>
      <dc:date>2025-09-30T02:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: XQL How to get all users that haven't logged in in the past 30 days.</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239208#M8762</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/1618025261"&gt;@W.Edmeades&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We do not collect data of things that did not happened (not logged in users). So you can not find things that did not happened on the logs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is rather better to look for users that have logged in in the last 30 days. And the ones not found are the ones that did not logged in in the last 30 days.&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 like and on "mark this as a Solution".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;KR,&lt;/P&gt;
&lt;P&gt;Luis&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2025 11:36:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239208#M8762</guid>
      <dc:creator>eluis</dc:creator>
      <dc:date>2025-10-01T11:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: XQL How to get all users that haven't logged in in the past 30 days.</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239231#M8763</link>
      <description>&lt;P&gt;Hi Eluis,&lt;/P&gt;
&lt;P&gt;Thank you for your response, but perhaps I should've been clearer. I wish to collate a list of users who haven't logged in within the previous 30 days - which is to say they&amp;nbsp;&lt;EM&gt;have&lt;/EM&gt; logged in before, just not since Sept 2 (if we're starting from today), so there'll definitely be logs for it. That being said, I wish for my aforementioned code to have the following requirements (I'm just lost as to how to put it together):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;a list of login timestamps for all users&lt;/LI&gt;
&lt;LI&gt;select the most recent login timestamp for each user&lt;/LI&gt;
&lt;LI&gt;remove all users who have logged in between today &amp;amp; 30 days ago.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 01 Oct 2025 23:40:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239231#M8763</guid>
      <dc:creator>W.Edmeades</dc:creator>
      <dc:date>2025-10-01T23:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: XQL How to get all users that haven't logged in in the past 30 days.</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239322#M8770</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/1618025261"&gt;@W.Edmeades&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;XQL queries can get quite complex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im gonna offer a different approach to solve this using the API get-users&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs-cortex.paloaltonetworks.com/r/Cortex-Platform-APIs/Get-Users?contentId=I7Cjp0wJsX6rWft4dVRPuQ" target="_blank"&gt;https://docs-cortex.paloaltonetworks.com/r/Cortex-Platform-APIs/Get-Users?contentId=I7Cjp0wJsX6rWft4dVRPuQ&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can get the&amp;nbsp;&lt;BR /&gt;last_logged_in type of data is integer = Timestamp of when the user last logged in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the appropriate logic in your script it should be possible to get the data your are looking for.&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 like and on "mark this as a Solution".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;KR,&lt;/P&gt;
&lt;P&gt;Luis&lt;/P&gt;</description>
      <pubDate>Thu, 02 Oct 2025 20:54:35 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/xql-how-to-get-all-users-that-haven-t-logged-in-in-the-past-30/m-p/1239322#M8770</guid>
      <dc:creator>eluis</dc:creator>
      <dc:date>2025-10-02T20:54:35Z</dc:date>
    </item>
  </channel>
</rss>

