<?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: Search string to filter filed not updated in last 24 hours in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295212#M164861</link>
    <description>&lt;P&gt;@Gowtham0809, from the query seems like you want to check whether there is any data source which has not data today but was sending data earlier. Instead of running base search on your index with all time search, you should leverage commands like &lt;CODE&gt;metadata&lt;/CODE&gt; or &lt;CODE&gt;tstats&lt;/CODE&gt; which are specifically meant for such use cases.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 1: Using Metadata command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type="sources" index="index"
| where lastTime&amp;lt;relative_time(now(),"-1d@d")
| fieldformat lastTime=strftime(lastTime,"%c")
| table source totalCount lastTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2: Using tstats command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count as Events earliest(_time) AS EarlistEventTime, latest(_time) AS LatestEventTime WHERE index="index" BY source
| where LatestEventTime&amp;lt;relative_time(now(),"-1d@d") 
| fieldformat LatestEventTime=strftime(LatestEventTime,"%c")
| table source Events LatestEventTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats#Examples"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats#Examples&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;PS: &lt;CODE&gt;"-1d@d"&lt;/CODE&gt; implies one day before, for last 24 hours ago you should use &lt;CODE&gt;"-24h@h"&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Nov 2017 08:07:23 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-11-24T08:07:23Z</dc:date>
    <item>
      <title>Search string to filter filed not updated in last 24 hours</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295210#M164859</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I use the below search to filer the source which were not updated on current day(Today)&lt;/P&gt;

&lt;P&gt;index=index sourcetype="sourcetype" source="source*.csv" | table  source, _time    | dedup  source | where _time &amp;lt; relative_time(now(),"-1d@d).&lt;/P&gt;

&lt;P&gt;This string was providing the results and not suddenly stops working.  No changes were made what so ever.&lt;/P&gt;

&lt;P&gt;can some one help me with this&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295210#M164859</guid>
      <dc:creator>Gowtham0809</dc:creator>
      <dc:date>2020-09-29T16:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search string to filter filed not updated in last 24 hours</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295211#M164860</link>
      <description>&lt;P&gt;Hi Gowtham, what's the error do you get when you run the query?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 04:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295211#M164860</guid>
      <dc:creator>MousumiChowdhur</dc:creator>
      <dc:date>2017-11-24T04:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search string to filter filed not updated in last 24 hours</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295212#M164861</link>
      <description>&lt;P&gt;@Gowtham0809, from the query seems like you want to check whether there is any data source which has not data today but was sending data earlier. Instead of running base search on your index with all time search, you should leverage commands like &lt;CODE&gt;metadata&lt;/CODE&gt; or &lt;CODE&gt;tstats&lt;/CODE&gt; which are specifically meant for such use cases.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 1: Using Metadata command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type="sources" index="index"
| where lastTime&amp;lt;relative_time(now(),"-1d@d")
| fieldformat lastTime=strftime(lastTime,"%c")
| table source totalCount lastTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2: Using tstats command&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count as Events earliest(_time) AS EarlistEventTime, latest(_time) AS LatestEventTime WHERE index="index" BY source
| where LatestEventTime&amp;lt;relative_time(now(),"-1d@d") 
| fieldformat LatestEventTime=strftime(LatestEventTime,"%c")
| table source Events LatestEventTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats#Examples"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Tstats#Examples&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;PS: &lt;CODE&gt;"-1d@d"&lt;/CODE&gt; implies one day before, for last 24 hours ago you should use &lt;CODE&gt;"-24h@h"&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 08:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295212#M164861</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-24T08:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Search string to filter filed not updated in last 24 hours</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295213#M164862</link>
      <description>&lt;P&gt;What @niketnilay said except that &lt;CODE&gt;metadata&lt;/CODE&gt; does strange things in regards to the TimePicker (because it has to: it has to judge on a bucket-by-bucket basis and any bucket may have a considerable span of events) so &lt;EM&gt;definitely&lt;/EM&gt; use &lt;CODE&gt;tstats&lt;/CODE&gt;.  Additionally, I would weight &lt;CODE&gt;_indextime&lt;/CODE&gt; more than &lt;CODE&gt;_time&lt;/CODE&gt; because what you really care about is that events are still being indexed, right?  So this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count max(_indextime) AS _time WHERE index="index" BY source
| eval secondsSinceLastIndexed = now() - _time
| sort 0 - secondsSinceLastIndexed
| lastIndexDistance=tostring(secondsSinceLastIndexed , "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 01:18:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-string-to-filter-filed-not-updated-in-last-24-hours/m-p/295213#M164862</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-11-27T01:18:39Z</dc:date>
    </item>
  </channel>
</rss>

