<?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 use streamstats and identify consecutive events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642558#M222564</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;We have applications Availability data in splunk.&lt;BR /&gt;With below SPL, I got this data.&lt;/P&gt;
&lt;P&gt;Base_SPL..| streamstats reset_on_change=true count as Real_Status by status,JonName&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The challenge is to identify, if 2 or more successive failure have happened.&lt;/P&gt;
&lt;P&gt;Only show ALL Fail events, if 2 or more successive failures.&lt;BR /&gt;In the below table, only the contents highlighted in RED needs to be shown. (Ignore Failure, highlighted in GREEN)&lt;BR /&gt;&lt;BR /&gt;If i filter with below SPL, then i will miss the 1st FAIL event (Highlighted in RED)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where Real_Status &amp;gt; 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how do I solve this challenge?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="262px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;JobName&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;status&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;Real_Status&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;Process1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;SUCCESS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;Process1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;SUCCESS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;Process1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;SUCCESS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;3&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Tue, 09 May 2023 06:27:22 GMT</pubDate>
    <dc:creator>gvk_us</dc:creator>
    <dc:date>2023-05-09T06:27:22Z</dc:date>
    <item>
      <title>How to use streamstats and identify consecutive events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642558#M222564</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;We have applications Availability data in splunk.&lt;BR /&gt;With below SPL, I got this data.&lt;/P&gt;
&lt;P&gt;Base_SPL..| streamstats reset_on_change=true count as Real_Status by status,JonName&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The challenge is to identify, if 2 or more successive failure have happened.&lt;/P&gt;
&lt;P&gt;Only show ALL Fail events, if 2 or more successive failures.&lt;BR /&gt;In the below table, only the contents highlighted in RED needs to be shown. (Ignore Failure, highlighted in GREEN)&lt;BR /&gt;&lt;BR /&gt;If i filter with below SPL, then i will miss the 1st FAIL event (Highlighted in RED)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where Real_Status &amp;gt; 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how do I solve this challenge?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="262px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;JobName&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;status&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;Real_Status&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;Process1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;SUCCESS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;Process1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;SUCCESS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;Process1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;SUCCESS&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="80.8906px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Process1&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="82.4844px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;FAIL&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98.6719px"&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;3&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 09 May 2023 06:27:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642558#M222564</guid>
      <dc:creator>gvk_us</dc:creator>
      <dc:date>2023-05-09T06:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with streamstats and identify consecutive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642562#M222567</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256529"&gt;@gvk_us&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This run anywhere example should meet your requirement...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="JobName,status
Process1,SUCCESS
Process1,SUCCESS
Process1,FAIL
Process1,SUCCESS
Process1,SUCCESS
Process1,FAIL
Process1,FAIL
Process1,FAIL"
| multikv forceheader=1
| table JobName,status
| streamstats window=2 count as Real_Status BY status JobName
| where status="FAIL" AND Real_Status&amp;gt;=2&lt;/LI-CODE&gt;&lt;P&gt;Hope that helps&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 20:53:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642562#M222567</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-05-08T20:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use streamstats and identify consecutive events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642563#M222568</link>
      <description>&lt;P&gt;Add another &lt;FONT face="courier new,courier"&gt;streamstats&lt;/FONT&gt; to find the maximum value of Real_Status and then filter out events with a max value &amp;lt; 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Base_SPL..
| streamstats reset_on_change=true count as Real_Status by status,JobName
| eventstats max(Real_Status) as conseq_status by status,JobName
| where conseq_status &amp;gt; 1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 12:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642563#M222568</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-05-09T12:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with streamstats and identify consecutive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642575#M222572</link>
      <description>&lt;P&gt;This solution is missing the 1st event of the consecutive events, as highlighted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gvk_us_0-1683600082515.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25268iA9A777A66729262E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gvk_us_0-1683600082515.png" alt="gvk_us_0-1683600082515.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 02:41:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642575#M222572</guid>
      <dc:creator>gvk_us</dc:creator>
      <dc:date>2023-05-09T02:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with streamstats and identify consecutive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642577#M222573</link>
      <description>&lt;P&gt;We are still missing the first event in the series of consecutive failures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gvk_us_0-1683600347966.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25269i275A0956F0DA0D47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gvk_us_0-1683600347966.png" alt="gvk_us_0-1683600347966.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 02:45:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642577#M222573</guid>
      <dc:creator>gvk_us</dc:creator>
      <dc:date>2023-05-09T02:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with streamstats and identify consecutive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642587#M222575</link>
      <description>&lt;P&gt;It's only a consecutive failure once the second occurrence happens so the first occurrence needs to be captured expanded out as an result row again.&lt;BR /&gt;&lt;BR /&gt;Extending on&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;'s better solution, something like this should work...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats reset_on_change=true count as Real_Status by status,JobName
| streamstats values(Real_Status) as status_values max(Real_Status) as conseq_status by status,JobName
| where status="FAIL" AND conseq_status&amp;gt;=2
| eval status_count=mvcount(status_values)
      ,status_values=if(status_count=2, status_values, null())
| mvexpand status_values
| eval Real_Status=if(status_count=2, status_values, Real_Status)
| table JobName status Real_Status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 03:59:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642587#M222575</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-05-09T03:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with streamstats and identify consecutive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642591#M222577</link>
      <description>&lt;P&gt;Building on solutions from both&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;, try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats reset_on_change=true count as Real_Status by status,JobName
| reverse
| streamstats reset_on_change=true max(Real_Status) as conseq_status by status,JobName
| where status="FAIL" AND conseq_status&amp;gt;1&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 09 May 2023 05:37:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642591#M222577</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-05-09T05:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with streamstats and identify consecutive events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642656#M222592</link>
      <description>&lt;P&gt;I see what I did wrong.&amp;nbsp; I've fixed my answer.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 12:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-streamstats-and-identify-consecutive-events/m-p/642656#M222592</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-05-09T12:41:15Z</dc:date>
    </item>
  </channel>
</rss>

