<?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: Alternate to EventStats | Using EventStats for a longer duration results in data loss in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488065#M136377</link>
    <description>&lt;P&gt;Actually ignore me the first solution worked, there need to be 'vldcxrs' also in the fields line &lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2020 07:45:39 GMT</pubDate>
    <dc:creator>nishantberiwal</dc:creator>
    <dc:date>2020-05-05T07:45:39Z</dc:date>
    <item>
      <title>Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488062#M136374</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;Is there an alternative to count all the events to 'eventstats' using it results in data loss if exceed the duration only works fine until 6 or 7 hours so.&lt;/P&gt;

&lt;P&gt;My search is basis 'transactionStatus = all', it works fine if I specify it as 'Failed' but using fail it doesnt calculate percentage by Total...but only by Total failed events or data count.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;My BaseSearch....  **transactionStatus=***  earliest=-**1d**
| eventstats count as "Total"
| rex field=_raw "Error response from Sabre pad for getDetails : ErrorType : BusinessLogic Code : ERR.SWS.HOST.ERROR_IN_RESPONSE, Message\s*:\s*(?.+)" 
| rex field=vldCxrs "carrierCode=(?..)" 
| search carrierCode=*
| stats count(eval(transactionStatus="FAILED")) as "Failed_Count" by Total, ErrorMsg, tpid, carrierCode
| eval Error_Percent=round((Failed_Count/Total)*100,2)
| fields tpid, carrierCode, ErrorMsg, Error_Percent, Failed_Count, Total
| sort -Failed_Count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Nishant&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 07:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488062#M136374</guid>
      <dc:creator>nishantberiwal</dc:creator>
      <dc:date>2020-04-28T07:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488063#M136375</link>
      <description>&lt;P&gt;Okay, I marked your code, but a couple of html-like features were stripped out, so be skeptical of this code and validate it carefully. &lt;/P&gt;

&lt;P&gt;I've made two changes here.  First, I've added a line immediately after the first pipe that limits the fields extracted to the ones you need. Second, I've moved "Total" in the stats command to not being a "by" field.  Each of those should get you some speed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; My BaseSearch....  **transactionStatus=***  earliest=-**1d**
 | fields  _raw  transactionStatus ErrorMsg tpid 
 | eventstats count as "Total"
 | rex field=_raw "Error response from Sabre pad for getDetails : ErrorType : BusinessLogic Code : ERR.SWS.HOST.ERROR_IN_RESPONSE, Message\s*:\s*(?&amp;lt;vldCxrs&amp;gt;.+)" 
 | rex field=vldCxrs "carrierCode=(?&amp;lt;carrierCode&amp;gt;..)" 
 | search carrierCode=*
 | stats count(eval(transactionStatus="FAILED")) as "Failed_Count" first(Total) as Total by ErrorMsg, tpid, carrierCode
 | eval Error_Percent=round((Failed_Count/Total)*100,2)
 | fields tpid, carrierCode, ErrorMsg, Error_Percent, Failed_Count, Total
 | sort - Failed_Count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Here's another way that might work faster, depending on data.  Here, instead of calculating &lt;CODE&gt;Total&lt;/CODE&gt; with an early &lt;CODE&gt;eventstats&lt;/CODE&gt;, we retain records without a &lt;CODE&gt;carrierCode&lt;/CODE&gt; and then calculate &lt;CODE&gt;Total&lt;/CODE&gt; with a late one, and THEN drop the records with no &lt;CODE&gt;carrierCode&lt;/CODE&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   My BaseSearch....  **transactionStatus=***  earliest=-**1d**
   | fields  _raw  transactionStatus ErrorMsg tpid 
   | rex field=_raw "Error response from Sabre pad for getDetails : ErrorType : BusinessLogic Code : ERR.SWS.HOST.ERROR_IN_RESPONSE, Message\s*:\s*(?&amp;lt;vldCxrs&amp;gt;.+)" 
   | rex field=vldCxrs "carrierCode=(?&amp;lt;carrierCode&amp;gt;..)" 
   | eval carrierCode=coalesce(carrierCode, "NONE")
   | stats count(eval(transactionStatus="FAILED")) as "Failed_Count" count as allCount by ErrorMsg, tpid, carrierCode
   | eventstats sum(allcount) as Total 
   | where carrierCode!="NONE"
   | eval Error_Percent=round((Failed_Count/Total)*100,2)
   | fields tpid, carrierCode, ErrorMsg, Error_Percent, Failed_Count, allCount, Total
   | sort - Failed_Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2020 16:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488063#M136375</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-04-28T16:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488064#M136376</link>
      <description>&lt;P&gt;Thanks, I am using the first solution where when adding this line &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;first(Total) as Total by ErrorMsg, tpid, carrierCode&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;It resulting in no results to be displayed for some reason. &lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 07:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488064#M136376</guid>
      <dc:creator>nishantberiwal</dc:creator>
      <dc:date>2020-05-05T07:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488065#M136377</link>
      <description>&lt;P&gt;Actually ignore me the first solution worked, there need to be 'vldcxrs' also in the fields line &lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 07:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488065#M136377</guid>
      <dc:creator>nishantberiwal</dc:creator>
      <dc:date>2020-05-05T07:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488066#M136378</link>
      <description>&lt;P&gt;Can you tell what does this "first(Total) as Total" do.&lt;/P&gt;

&lt;P&gt;its also working if I simply do 'by Total'&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 07:46:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488066#M136378</guid>
      <dc:creator>nishantberiwal</dc:creator>
      <dc:date>2020-05-05T07:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488067#M136379</link>
      <description>&lt;P&gt;Lastly - This query could not keep up when did 3 days, but it was a great alternative.....The only alternate way I found to make this work is by joining 3 different queries where 'Total' is calculated separately and 'ErrorMsg' is counted separately. &lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 08:09:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488067#M136379</guid>
      <dc:creator>nishantberiwal</dc:creator>
      <dc:date>2020-05-05T08:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to EventStats | Using EventStats for a longer duration results in data loss</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488068#M136380</link>
      <description>&lt;P&gt;The Join query on 3 days not only returned results but also took about 430 KB compared to single query which is not able to handle 3days plus consumes 450 MB&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 08:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alternate-to-EventStats-Using-EventStats-for-a-longer-duration/m-p/488068#M136380</guid>
      <dc:creator>nishantberiwal</dc:creator>
      <dc:date>2020-05-05T08:27:06Z</dc:date>
    </item>
  </channel>
</rss>

