<?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 How to search for a field value during a certain period of time using an extracted time field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276995#M83540</link>
    <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have an extracted field from regex, ie Time_extract which gives hour. Now I want to get the logs between a period of time, ie &lt;CODE&gt;time_extract&amp;gt;=10 AND time_extract&amp;lt;23&lt;/CODE&gt; ..how to go about that?&lt;/P&gt;

&lt;P&gt;Current search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date_extract="10/29/16" | stats count by severity | where Time_extract&amp;gt;=12 AND Time_extract&amp;lt;23
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 11:34:33 GMT</pubDate>
    <dc:creator>arunkuriakose</dc:creator>
    <dc:date>2020-09-29T11:34:33Z</dc:date>
    <item>
      <title>How to search for a field value during a certain period of time using an extracted time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276995#M83540</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have an extracted field from regex, ie Time_extract which gives hour. Now I want to get the logs between a period of time, ie &lt;CODE&gt;time_extract&amp;gt;=10 AND time_extract&amp;lt;23&lt;/CODE&gt; ..how to go about that?&lt;/P&gt;

&lt;P&gt;Current search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date_extract="10/29/16" | stats count by severity | where Time_extract&amp;gt;=12 AND Time_extract&amp;lt;23
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:34:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276995#M83540</guid>
      <dc:creator>arunkuriakose</dc:creator>
      <dc:date>2020-09-29T11:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field value during a certain period of time using an extracted time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276996#M83541</link>
      <description>&lt;P&gt;Does Splunk not automatically extract the field "date_hour" for you? If you look at your data in a search dashboard, do you see "date_hour" extracted if you run the search in "Verbose mode" (changed "Fast Mode" or "Smart Mode" under the time picker to "Verbose Mode).&lt;/P&gt;

&lt;P&gt;If you do see "date_hour", you should be able to change your search to something like this (note, expressions in the base search use implicit AND logic):&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;base_search&amp;gt;  date_hour&amp;gt;=12  date_hour&amp;lt;23 | stats count by severity&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:37:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276996#M83541</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2020-09-29T11:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field value during a certain period of time using an extracted time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276997#M83542</link>
      <description>&lt;P&gt;Can you have a look at the link provided here which explains both extraction of hour and searching on it or alternatively using date_hour (and what could be the consequences of it in &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/188962"&gt;@ppablo&lt;/a&gt;_splunk 's comments of the post):&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/469147/how-to-adjust-the-time-in-a-timechart.html#answer-469150" target="_blank"&gt;https://answers.splunk.com/answers/469147/how-to-adjust-the-time-in-a-timechart.html#answer-469150&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However what you should be looking at is something like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your Query that returns data 
 |eval myHour=strftime(_time, "%H") 
 | where myHour&amp;gt;=12  AND myHour&amp;lt;23
 | stats count by severity
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276997#M83542</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2020-09-29T11:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to search for a field value during a certain period of time using an extracted time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276998#M83543</link>
      <description>&lt;P&gt;You just need to do the &lt;CODE&gt;where time_extract&lt;/CODE&gt; BEFORE the &lt;CODE&gt;stats&lt;/CODE&gt; command. You could also combine the two filters, like this&lt;/P&gt;

&lt;P&gt;... | where Date_extract="10/29/16" AND (Time_extract&amp;gt;=12 AND Time_extract&amp;lt;23)  | stats count by severity&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-a-field-value-during-a-certain-period-of-time/m-p/276998#M83543</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2020-09-29T11:34:42Z</dc:date>
    </item>
  </channel>
</rss>

