<?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: Changing a real-time search to date range search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197297#M56988</link>
    <description>&lt;P&gt;It's not real time anymore. It's running once every 10 minutes.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2014 14:55:49 GMT</pubDate>
    <dc:creator>matthewcanty</dc:creator>
    <dc:date>2014-01-07T14:55:49Z</dc:date>
    <item>
      <title>Changing a real-time search to date range search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197294#M56985</link>
      <description>&lt;P&gt;Hi all. I have been working on a query to alert us to when a date changes for a specific item, the item is represented in my query as GroupId. Dates can change any number of times, and I want to receive an alert whenever they do.&lt;/P&gt;

&lt;P&gt;I have come up with the following real-time search. I am concerned about it only having the data available from when the search starts.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=daluat PublishedGtpRule GroupId | dedup 100 GroupId sortby -_time | stats first(Date) As CurrentDate list(Date) As PreviousDates dc(Date) As Count by GroupId | where Count&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;I'll try my best to explain what I think would work best.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Search for distinct GroupIds over a time period&lt;/LI&gt;
&lt;LI&gt;For each GroupId, search for the previous occurrence of it - all time&lt;/LI&gt;
&lt;LI&gt;Result if date has changed&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Preferably I'd like to see what the new and previous dates are too. &lt;/P&gt;

&lt;P&gt;This way my alerting doesn't have to be real-time. I can simply run it every minute, and look back over the last 2 or 3 minutes and allow the subsearch to go back through all time to find the last occurrence of a GroupId.&lt;/P&gt;

&lt;P&gt;FYI the number of GroupIds per minute is a low number, 10 at most.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2014 11:42:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197294#M56985</guid>
      <dc:creator>matthewcanty</dc:creator>
      <dc:date>2014-01-07T11:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a real-time search to date range search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197295#M56986</link>
      <description>&lt;P&gt;I have solved my problem. &lt;STRONG&gt;If anyone has any &lt;EM&gt;cleaner&lt;/EM&gt; suggestions&lt;/STRONG&gt; I would be more than happy to hear from you. I hope this helps someone one day.&lt;/P&gt;

&lt;P&gt;I run the following search on a schedule &lt;STRONG&gt;every 10 minutes&lt;/STRONG&gt; with a time range from &lt;STRONG&gt;&lt;EM&gt;-1y&lt;/EM&gt;&lt;/STRONG&gt; to &lt;STRONG&gt;&lt;EM&gt;now&lt;/EM&gt;&lt;/STRONG&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=daluat Published GroupId 
| DEDUP 2 GroupId 
| STATS DC(Date) AS dist_dates FIRST(Date) AS NewDate LAST(Date) AS OldDate LATEST(_time) AS latest_time BY GroupId
| EVAL relative_time_threshold=relative_time(now(),"-10m") 
| WHERE latest_time&amp;gt;relative_time_threshold AND dist_dates&amp;gt;1 
| CONVERT CTIME(latest_time) 
| FIELDS GroupId NewDate OldDate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jan 2014 14:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197295#M56986</guid>
      <dc:creator>matthewcanty</dc:creator>
      <dc:date>2014-01-07T14:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a real-time search to date range search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197296#M56987</link>
      <description>&lt;P&gt;if it is a realtime then shouldn't it be -1y to rt?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2014 14:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197296#M56987</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-07T14:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Changing a real-time search to date range search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197297#M56988</link>
      <description>&lt;P&gt;It's not real time anymore. It's running once every 10 minutes.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2014 14:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-a-real-time-search-to-date-range-search/m-p/197297#M56988</guid>
      <dc:creator>matthewcanty</dc:creator>
      <dc:date>2014-01-07T14:55:49Z</dc:date>
    </item>
  </channel>
</rss>

