<?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 filter time for specific range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579789#M202023</link>
    <description>&lt;P&gt;| savedsearch cbp_inc_base | eval _time=strftime(opened_time, "%Y/%m/%d") |&lt;BR /&gt;| bin _time span=1d&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here _ time is giving complete data, i want to filter it for one month i.e.. 30days. I tried relative_time, but its giving only for specific day&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 12:54:18 GMT</pubDate>
    <dc:creator>neethan</dc:creator>
    <dc:date>2022-01-03T12:54:18Z</dc:date>
    <item>
      <title>filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579789#M202023</link>
      <description>&lt;P&gt;| savedsearch cbp_inc_base | eval _time=strftime(opened_time, "%Y/%m/%d") |&lt;BR /&gt;| bin _time span=1d&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here _ time is giving complete data, i want to filter it for one month i.e.. 30days. I tried relative_time, but its giving only for specific day&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 12:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579789#M202023</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-03T12:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579791#M202024</link>
      <description>&lt;P&gt;Please tell us more about your use case and what you've tried so far.&amp;nbsp; When do the 30 days begin and end?&amp;nbsp; Is opened_time the start or end of the month?&amp;nbsp; What did you try with &lt;FONT face="courier new,courier"&gt;relative_time&lt;/FONT&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 14:39:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579791#M202024</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-01-03T14:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579792#M202025</link>
      <description>&lt;P&gt;I am getting data like this, but i want data only for previous 30days&lt;/P&gt;&lt;P&gt;_time false true&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2021/07/21&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2021/10/04&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2021/10/14&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2021/11/04&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| savedsearch cbp_inc_base | eval _time=strftime(opened_time, "%Y/%m/%d") |eval _time = if(_time&amp;lt;relative_time(now(),"-3d@d") AND _time&amp;gt;relative_time(now(),"-30d@d"))&lt;BR /&gt;| bin _time span=1d&amp;nbsp; &amp;nbsp; /// this errors&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| savedsearch cbp_inc_base | eval _time=strftime(opened_time, "%Y/%m/%d") |eval _time&amp;lt;relative_time(now(),"-3d@d")&amp;nbsp; &amp;nbsp; /// this gives data for that particular day i.e. Dec 31st data&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 15:08:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579792#M202025</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-03T15:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579804#M202028</link>
      <description>&lt;P&gt;You were close!&amp;nbsp; The &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; command assigns a value to a field.&amp;nbsp; To filter events based on field values, use the &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| savedsearch cbp_inc_base 
| eval _time=strftime(opened_time, "%Y/%m/%d") 
| where (_time&amp;lt;relative_time(now(),"-3d@d") AND _time&amp;gt;relative_time(now(),"-30d@d"))
| bin _time span=1d &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 18:43:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579804#M202028</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-01-03T18:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579826#M202037</link>
      <description>&lt;P&gt;here _time&amp;gt; condition will print sep, oct,nov values as well, but my requirement is to print only previous months&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| savedsearch cbp_inc_base 
| eval _time=strftime(opened_time, "%Y/%m/%d") 
| where (_time&amp;lt;relative_time(now(),"-3d@d") AND _time&amp;gt;relative_time(now(),"-30d@d"))
| bin _time span=1d &lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Jan 2022 06:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579826#M202037</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-04T06:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579830#M202038</link>
      <description>&lt;P&gt;here _time&amp;gt; condition will print sep, oct,nov values as well, but my requirement is to print only previous months&lt;/P&gt;&lt;PRE&gt;| savedsearch cbp_inc_base 
| eval _time=strftime(opened_time, "%Y/%m/%d") 
| where (_time&amp;lt;relative_time(now(),"-3d@d") AND _time&amp;gt;relative_time(now(),"-30d@d"))
| bin _time span=1d &lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jan 2022 07:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579830#M202038</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-04T07:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579835#M202042</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you should replace where with this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where (_time &amp;lt;= relative_time(now(),"@mon")) AND (_time &amp;gt;= relative_time(now(),"-1mon@mon"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course it will be best if you can add this already on search from index phase as earliest=.... AND latest=... that was the most efficient way to do the query.&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;&lt;P&gt;And just like&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;said, don't convert _time. Splunk UI will do that conversion when needed automatic. So just drop that eval _time = strftime... from there.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 08:30:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579835#M202042</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-01-04T08:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579843#M202047</link>
      <description>&lt;P&gt;Why are you converting _time to a string (strftime) then comparing to a numeric value (relative_time)? Try doing your comparisons before you convert _time to a string.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 08:25:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579843#M202047</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-04T08:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579848#M202048</link>
      <description>&lt;P&gt;the query you ave given is not working.&lt;/P&gt;&lt;P&gt;I did include earliest in my base search, but still it gives old data. Not sure from where its picking&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="ab" source_name=xy platformName=REDHAT earliest=-24h&lt;BR /&gt;| table hostName, source_name, hasAppBlueprints | rename hostName as hostname&lt;BR /&gt;| join type=inner max=0 hostname [ search&lt;BR /&gt;index=abc source_name=xyz earliest=-21d | dedup incident_number&lt;BR /&gt;| rex field=transfer_description "found as (?&amp;lt;correct_host&amp;gt;[a-zA-Z0-9\-]+) "&lt;BR /&gt;| rename configuration_item as hostname&lt;BR /&gt;| eval opened_time=strptime(opened_time, "%b %d, %Y %H:%M:%S")&lt;BR /&gt;| table hostname, alert_id, incident_number, correct_host, opened_time&lt;BR /&gt;| eval hostname=case(match(hostname, ".* .*"), correct_host, 1==1, hostname) ]&lt;BR /&gt;| table hostname, alert_id, incident_number, source_name, opened_time, hasAppBlueprints&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 10:24:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579848#M202048</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-04T10:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579997#M202089</link>
      <description>&lt;P&gt;the query you ave given is not working.&lt;/P&gt;&lt;P&gt;I did include earliest in my base search, but still it gives old data. Not sure from where its picking&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="ab" source_name=xy platformName=REDHAT earliest=-24h&lt;BR /&gt;| table hostName, source_name, hasAppBlueprints | rename hostName as hostname&lt;BR /&gt;| join type=inner max=0 hostname [ search&lt;BR /&gt;index=abc source_name=xyz earliest=-21d | dedup incident_number&lt;BR /&gt;| rex field=transfer_description "found as (?&amp;lt;correct_host&amp;gt;[a-zA-Z0-9\-]+) "&lt;BR /&gt;| rename configuration_item as hostname&lt;BR /&gt;| eval opened_time=strptime(opened_time, "%b %d, %Y %H:%M:%S")&lt;BR /&gt;| table hostname, alert_id, incident_number, correct_host, opened_time&lt;BR /&gt;| eval hostname=case(match(hostname, ".* .*"), correct_host, 1==1, hostname) ]&lt;BR /&gt;| table hostname, alert_id, incident_number, source_name, opened_time, hasAppBlueprints&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 13:11:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/579997#M202089</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-05T13:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: filter time for specific range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/580000#M202091</link>
      <description>&lt;P&gt;Thanks for all your help, i modified base search as below and it worked&lt;/P&gt;&lt;P&gt;| eval opened_time=strptime(opened_time, "%b %d, %Y %H:%M:%S")&lt;BR /&gt;| where (opened_time &amp;lt;= relative_time(now(),"@d")) AND (opened_time &amp;gt;= relative_time(now(),"-30d@d"))&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 13:21:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/filter-time-for-specific-range/m-p/580000#M202091</guid>
      <dc:creator>neethan</dc:creator>
      <dc:date>2022-01-05T13:21:20Z</dc:date>
    </item>
  </channel>
</rss>

