<?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: using eval and time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687089#M234346</link>
    <description>&lt;P&gt;thanks this has worked perfectly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2024 19:13:18 GMT</pubDate>
    <dc:creator>PaulaCom</dc:creator>
    <dc:date>2024-05-09T19:13:18Z</dc:date>
    <item>
      <title>using eval and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687033#M234320</link>
      <description>&lt;P&gt;Afternoon All&lt;/P&gt;
&lt;P&gt;i'd like some help please with some SPL logic that i just cant crack &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have data on some user in our Active Directory system and i am trying to:&lt;/P&gt;
&lt;P&gt;create a new column with actions&lt;/P&gt;
&lt;P&gt;identify those who have no logged in for more than 61 days and is so the action should return "reset password"&lt;/P&gt;
&lt;P&gt;here's the part that i am having an issue with below. the first two lines are working as expected returning last_logon_total&amp;nbsp; day, month, year&lt;/P&gt;
&lt;P&gt;i have a new field i created called 'action' that i want to return a value in of those users who have not logged in for more than 61 days.. but i cant get the spl right.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval epoch_lastLogonTimestamp_date = strptime(lastLogonTimestamp, "%Y-%m-%dT%H:%M:%S")
| eval last_logon_total = strftime(epoch_lastLogonTimestamp_date, "%d/%m/%Y")
| eval action = if(last_logon_total = relative_time(), "-61d@d", "reset password")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any ideas ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Paula&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 14:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687033#M234320</guid>
      <dc:creator>PaulaCom</dc:creator>
      <dc:date>2024-05-09T14:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: using eval and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687041#M234325</link>
      <description>&lt;P&gt;There were a few errors, but this should work.&amp;nbsp; Note I broke out the comparison_date calculation from the eval where you decide if they need to reset or not, to a) make it more clear and b) so you can see the dates/strings it's comparing with.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format="CSV" data="date
2024-05-09T08:05:00
2024-02-09T08:05:00"
| eval epoch_lastLogonTimestamp_date = strptime(date, "%Y-%m-%dT%H:%M:%S")
| eval last_logon_total = strftime(epoch_lastLogonTimestamp_date, "%d/%m/%Y")
| eval comparison_date = relative_time(now(),"-61d@d")
| eval action = if(epoch_lastLogonTimestamp_date &amp;lt;= comparison_date, "reset password", "no change needed")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the biggest issue was that the epoch date is the only one you need.&amp;nbsp; Do your math on it, work with it.&amp;nbsp; If you need to see it in a more human readable version, you can convert it back at the end.&amp;nbsp; In this case, 'last_logon_total' is simply unused after you build it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Happy splunking, and if this helped karma would be appreciated!&lt;/P&gt;&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 13:50:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687041#M234325</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2024-05-09T13:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: using eval and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687089#M234346</link>
      <description>&lt;P&gt;thanks this has worked perfectly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 19:13:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-eval-and-time/m-p/687089#M234346</guid>
      <dc:creator>PaulaCom</dc:creator>
      <dc:date>2024-05-09T19:13:18Z</dc:date>
    </item>
  </channel>
</rss>

