<?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: time now to 24 hours earlier search with %H:%M:%S AM/PM, %a %m/%d/%Y format in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/658119#M227333</link>
    <description>&lt;P&gt;You will need a closing parenthesis in the eval statement if you copy and paste this solution.&amp;nbsp; Thank you for the assist!&lt;/P&gt;&lt;P&gt;| eval created=strptime(whenCreated, "%I:%M:%S %p, %a %m/%d/%y")&lt;BR /&gt;| where created&amp;gt;=relative_time(now(), "-48h")&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 12:45:55 GMT</pubDate>
    <dc:creator>flynegal</dc:creator>
    <dc:date>2023-09-20T12:45:55Z</dc:date>
    <item>
      <title>How do you set up the search so that it will search for the last 24 hours using the current date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/657780#M227182</link>
      <description>&lt;P&gt;Splunk newby here.&amp;nbsp; I have a search that works if I change it every day but would like to add it to a dashboard for monitoring without having to change the date.&amp;nbsp; It looks for all the newly created accounts in the current/past day, depending on what date I put in. The search is index=Activedirectory whenCreated="*,9/15/23" |table whenCreated, name, manager, title, description then search for last 24 hours.&amp;nbsp; The format of the time is %H:%M:%S AM/PM, %a %m/%d/%Y.&amp;nbsp; The 2 issues I am having are, how do you specify the AM/PM and how do you set up the search so that it will search for the last 24 hours using the current date.&amp;nbsp; I was thinking it is "time()" but I am not successful in getting the results I need.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 22:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/657780#M227182</guid>
      <dc:creator>flynegal</dc:creator>
      <dc:date>2023-09-18T22:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: time now to 24 hours earlier search with %H:%M:%S AM/PM, %a %m/%d/%Y format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/657792#M227191</link>
      <description>&lt;P&gt;You can override the time picker by setting earliest and latest on your initial search line&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=Activedirectory earliest=-24h latest=now()&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 16 Sep 2023 06:16:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/657792#M227191</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-16T06:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: time now to 24 hours earlier search with %H:%M:%S AM/PM, %a %m/%d/%Y format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/657831#M227216</link>
      <description>&lt;P&gt;Does the _time of the event equate to the time of the whenCreated field?&lt;/P&gt;&lt;P&gt;If your event time is different to the whenCreated value, then if you want to find all accounts created in the past day, you need to know what the event times will be for those events - Splunk will always retrieve events from a given time window you specify.&lt;/P&gt;&lt;P&gt;If you just search for -24h to now then if you have events where the&amp;nbsp;&lt;STRONG&gt;whenCreated&lt;/STRONG&gt; date is older than 24 hours ago then you need to parse that field and compare, i.e.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| eval created=strptime(whenCreated, "%I:%M:%S %p, %a %m/%d/%y"
| where created&amp;gt;=relative_time(now(), "-24h")&lt;/LI-CODE&gt;&lt;P&gt;As for your time format string, there are a 3 issues&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;%H is a 24 hour clock and as you have AM/PM in your time string, you would use %I to parse a 12 hour format.&lt;/LI&gt;&lt;LI&gt;%p is the notation for AM/PM&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;%Y is a 4 digit year - your whenCreated date is only 2 digits, in which case you should use %y&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;See the docs here&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Commontimeformatvariables" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Commontimeformatvariables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 00:17:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/657831#M227216</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-18T00:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: time now to 24 hours earlier search with %H:%M:%S AM/PM, %a %m/%d/%Y format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/658119#M227333</link>
      <description>&lt;P&gt;You will need a closing parenthesis in the eval statement if you copy and paste this solution.&amp;nbsp; Thank you for the assist!&lt;/P&gt;&lt;P&gt;| eval created=strptime(whenCreated, "%I:%M:%S %p, %a %m/%d/%y")&lt;BR /&gt;| where created&amp;gt;=relative_time(now(), "-48h")&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 12:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-set-up-the-search-so-that-it-will-search-for-the-last/m-p/658119#M227333</guid>
      <dc:creator>flynegal</dc:creator>
      <dc:date>2023-09-20T12:45:55Z</dc:date>
    </item>
  </channel>
</rss>

