<?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: comparing events within same field and it should continues in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309535#M161035</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Saerch
| eval time = "Dispatch Time"
| rex field=time mode=sed "s/://g"
| streamstats current=f last(time) AS prev_time BY ID
| eval Mispatch = if((time &amp;lt; prev_time), "TRUE", null())
| where isnotnull(Mispatch)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 May 2017 14:06:00 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-05-24T14:06:00Z</dc:date>
    <item>
      <title>comparing events within same field and it should continues</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309531#M161031</link>
      <description>&lt;P&gt;We need to find out the Ids along with DispatchTime which are not dispatched in correct sequence.&lt;BR /&gt;
ID                             DispatchTime&lt;BR /&gt;
1                               05/22/17 02:13:01&lt;BR /&gt;
1                                05/22/17 02:17:13&lt;BR /&gt;
1                                05/22/17 02:15:33             --- It is dispatched before 2nd event dispatch,&lt;BR /&gt;
1                                05/22/17 02:22:03&lt;BR /&gt;
2                               05/22/17 02:25:56&lt;BR /&gt;
2                                 05/22/17 02:26:18&lt;BR /&gt;
2                                 05/22/17 02:24:37             ------ it is dispatched before above 2 events.&lt;BR /&gt;
3                                05/22/17 02:31:19&lt;BR /&gt;
3                                 05/22/17 02:50:03&lt;BR /&gt;
3                                 05/22/17 02:53:29            ----- it is dispatched in wrong sequence&lt;BR /&gt;
3                                 05/22/17 02:51:52 &lt;BR /&gt;
4                                05/22/17 03:01:34&lt;BR /&gt;
4                                 05/22/17 22:01:30&lt;BR /&gt;
4                                 05/22/17 22:01:30&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 03:21:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309531#M161031</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-24T03:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: comparing events within same field and it should continues</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309532#M161032</link>
      <description>&lt;P&gt;@srinivasup, besides the Dispatch Time do you have event time (i.e. _time) which confirms that Dispatch Times are out of sequence? Also what are the field Names for ID, Dispatch Time?&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 03:31:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309532#M161032</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-05-24T03:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: comparing events within same field and it should continues</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309533#M161033</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;After all calculation i have got this ouput, so now we need to compare Dispatch time sequence for each ID.&lt;/P&gt;

&lt;P&gt;If dispatch time sequence is not in order, out of order id and dispatch time should be displayed.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 06:30:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309533#M161033</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-24T06:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: comparing events within same field and it should continues</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309534#M161034</link>
      <description>&lt;P&gt;As far as your query is giving the above result in the same sequence, you can use &lt;STRONG&gt;streamstats&lt;/STRONG&gt; to get the previous value of &lt;STRONG&gt;"Dispatch Time"&lt;/STRONG&gt; and then compare that Previous Value should not be greater than current:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Your Base Search&amp;gt;
| streamstats current=f global=f window=1 last("Dispatch Time") as Last_Dispatch_Time by ID
| eval status=if(isnull(Last_Dispatch_Time) OR Last_Dispatch_Time&amp;lt;='Dispatch Time',"Correct","Incorrect")
| table  ID "Dispatch Time" Last_Dispatch_Time status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: isnull(Last_Dispatch_Time) is for the first event since it will not have any data.&lt;BR /&gt;
Streamstats works based on how data is sorted, so make sure your base query is returning results in the sequence you expect (as mentioned in your question)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:14:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309534#M161034</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T14:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: comparing events within same field and it should continues</title>
      <link>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309535#M161035</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Saerch
| eval time = "Dispatch Time"
| rex field=time mode=sed "s/://g"
| streamstats current=f last(time) AS prev_time BY ID
| eval Mispatch = if((time &amp;lt; prev_time), "TRUE", null())
| where isnotnull(Mispatch)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 14:06:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/comparing-events-within-same-field-and-it-should-continues/m-p/309535#M161035</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-24T14:06:00Z</dc:date>
    </item>
  </channel>
</rss>

