<?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: How to select data within selected timerange on particular fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192595#M55397</link>
    <description>&lt;P&gt;Hi @somesoni2, &lt;/P&gt;

&lt;P&gt;Does &lt;CODE&gt;|gentimes start=-1&lt;/CODE&gt; means to search data with condition 1 day back? If so, I couldnt get any results even when I change the value.&lt;/P&gt;

&lt;P&gt;I tried &lt;CODE&gt;-30&lt;/CODE&gt;, and date as follow but still not working.&lt;/P&gt;

&lt;P&gt;here is my completed search string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=blah Field1="Value1" | eval time_submitted=strptime(time_submitted, "%m/%d/%Y") | eval _time=time_submitted | eval FormattedOrderDate=strftime(_time, "%m/%d/%Y") | stats count(ticket_number) as inflow by FormattedOrderDate |search earliest=-30d@d time_submitted&amp;gt; [|gentimes start=08/01/2015 | addinfo | return $info_min_time]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Aug 2015 02:55:51 GMT</pubDate>
    <dc:creator>imanpoeiri</dc:creator>
    <dc:date>2015-08-26T02:55:51Z</dc:date>
    <item>
      <title>How to select data within selected timerange on particular fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192592#M55394</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;

&lt;P&gt;I understand we can re-write &lt;CODE&gt;_time&lt;/CODE&gt; with particular timefield with this formula &lt;CODE&gt;eval _time=strptime(time_submitted, "%m/%d/%Y")&lt;/CODE&gt; but if I re-write the _time, I notice that the time pickers on the right of the search box are not working. I can't select for data Yesterday, or Month to date, etc...&lt;/P&gt;

&lt;P&gt;Is there a way to select timerange with the fields that we like?&lt;/P&gt;

&lt;P&gt;The search that I am looking to run similar to a SQL query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SELECT time_created, time_completed, order_id
FROM myTable
WHERE time_created &amp;gt; "mm-dd-yyyy hh:mi:ss"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Appreciate for the response!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2015 07:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192592#M55394</guid>
      <dc:creator>imanpoeiri</dc:creator>
      <dc:date>2015-08-25T07:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to select data within selected timerange on particular fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192593#M55395</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;the best would be to chose the correct field for _time at indexing time. if you want _time to be something else, for example it should alwas have the time of field time_created, you should configure this in the sourcetype.&lt;/P&gt;

&lt;P&gt;You could also use &lt;CODE&gt;eval epoch=strptime(time_created, "%m/%d/%Y")&lt;/CODE&gt;, then you have an epoch in field epoch and you can use this field in your search, for example: &lt;CODE&gt;index=myTable | eval epoch=strptime(time_created, "%m/%d/%Y") | where epoch &amp;gt; 1440490286  | table time_created time_completed order_id&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The backfall is, that you still have to chose a time in the default timerangepicker, therefore, you should use a timerange that definitly covers your results.&lt;/P&gt;

&lt;P&gt;Greetings&lt;/P&gt;

&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192593#M55395</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2020-09-29T07:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to select data within selected timerange on particular fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192594#M55396</link>
      <description>&lt;P&gt;Try this workaround (first we need to override the timerange picker from the base search (all time) and then provided your custom condition)&lt;BR /&gt;
If time_submitted is already in epoch format&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=blah sourcetype=foo earliest=0 time_submitted&amp;gt; [|gentimes start=-1 | addinfo | return $info_min_time] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If time_submitted is not epoch and is in format "%m/%d/%Y"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=blah sourcetype=foo earliest=0 | where strptime(time_submitted, "%m/%d/%Y")&amp;gt; [|gentimes start=-1 | addinfo | return $info_min_time]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Aug 2015 19:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192594#M55396</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-08-25T19:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to select data within selected timerange on particular fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192595#M55397</link>
      <description>&lt;P&gt;Hi @somesoni2, &lt;/P&gt;

&lt;P&gt;Does &lt;CODE&gt;|gentimes start=-1&lt;/CODE&gt; means to search data with condition 1 day back? If so, I couldnt get any results even when I change the value.&lt;/P&gt;

&lt;P&gt;I tried &lt;CODE&gt;-30&lt;/CODE&gt;, and date as follow but still not working.&lt;/P&gt;

&lt;P&gt;here is my completed search string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=blah Field1="Value1" | eval time_submitted=strptime(time_submitted, "%m/%d/%Y") | eval _time=time_submitted | eval FormattedOrderDate=strftime(_time, "%m/%d/%Y") | stats count(ticket_number) as inflow by FormattedOrderDate |search earliest=-30d@d time_submitted&amp;gt; [|gentimes start=08/01/2015 | addinfo | return $info_min_time]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Aug 2015 02:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-select-data-within-selected-timerange-on-particular/m-p/192595#M55397</guid>
      <dc:creator>imanpoeiri</dc:creator>
      <dc:date>2015-08-26T02:55:51Z</dc:date>
    </item>
  </channel>
</rss>

