<?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: How to count success/fail event and group them by another field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368533#M108612</link>
    <description>&lt;P&gt;column "condition" sometimes have "status success or fail" and sometimes "port":"1521", "port":7051" and so on. &lt;/P&gt;</description>
    <pubDate>Fri, 29 Dec 2017 11:38:03 GMT</pubDate>
    <dc:creator>someguy73</dc:creator>
    <dc:date>2017-12-29T11:38:03Z</dc:date>
    <item>
      <title>How to count success/fail event and group them by another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368531#M108610</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;

&lt;P&gt;My data have this form&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4084i9BBEEEAFAE2D7776/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I'm trying to make table in splunk, that will aggregate data to next format:&lt;/P&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;name            from        to              Status      Total_Success      Total_fail
KFI.Database    perun1      10.621.20.32            success        15               0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But my search don't work ( server sent me JSON file)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="tcp:8080" index="qfi_sandbox_business"
| spath 
| rename message AS condition
| rename message AS to 
| eval a=mvzip(Type,condition)
| eval b=mvzip(environment,condition)
| eval x=mvzip(a,b)
| mvexpand x
| eval x=split(x, ",")
| eval condition=mvindex(x,1)
| eval to=mvindex(x,2) 
| eval name=mvindex(x,3) 
| chart count as total over name by MESSAGE="*SUCCESS*"  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;( if i start search without capital letters ( by MESSAGE="&lt;EM&gt;SUCCESS&lt;/EM&gt;") , its run perfectly, but count all event, when I want count separately FAIL and SUCCESS. When i start in that combination it show a error ) &lt;/P&gt;

&lt;P&gt;Also I have little bit another search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="tcp:8080" index="qfi_sandbox_business"
| spath 
| rename message AS condition
| rename message AS condition2 
| eval a=mvzip(Type,condition)
| eval b=mvzip(environment,condition)
| eval x=mvzip(a,b)
| mvexpand x
| eval x=split(x, ",")
| eval condition=mvindex(x,1)
| eval condition2=mvindex(x,2) 
| eval name=mvindex(x,3) 
| table  name, host, condition2, condition
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which parse JSON string (every time in different way)  and produce table &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4085i4702B3A151F338EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;So, how to combine that two search and count success and fail ?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 09:37:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368531#M108610</guid>
      <dc:creator>someguy73</dc:creator>
      <dc:date>2017-12-29T09:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to count success/fail event and group them by another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368532#M108611</link>
      <description>&lt;P&gt;UPDATE&lt;/P&gt;

&lt;P&gt;Change to string &lt;CODE&gt;chart as total over name by condition&lt;/CODE&gt; and received table, which count correct info. But becouse of JSON parsiring each time in different way it brings me odd information &lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 11:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368532#M108611</guid>
      <dc:creator>someguy73</dc:creator>
      <dc:date>2017-12-29T11:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to count success/fail event and group them by another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368533#M108612</link>
      <description>&lt;P&gt;column "condition" sometimes have "status success or fail" and sometimes "port":"1521", "port":7051" and so on. &lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 11:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368533#M108612</guid>
      <dc:creator>someguy73</dc:creator>
      <dc:date>2017-12-29T11:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to count success/fail event and group them by another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368534#M108613</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="tcp:8080" index="qfi_sandbox_business"
| spath 
| rename message.port as port message.status as status message.name as name message.host as to host as from
| eval temp=mvzip(mvzip(mvzip(port, status),name),to)
| table host temp
| mvexpand temp
| rex field=temp "(?&amp;lt;port&amp;gt;[^,]+),(?&amp;lt;status&amp;gt;[^,]+),(?&amp;lt;name&amp;gt;[^,]+),(?&amp;lt;to&amp;gt;[^,]+)"
| eval Success=if(status="SUCCESS",1,0)
| eval Failure=if(status!="SUCCESS",1,0)
| stats sum(Success) as Total_Success sum(Failure) as Total_Failure by name from to
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Above is missing the Status column. How are you calculating it?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 15:13:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368534#M108613</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-29T15:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to count success/fail event and group them by another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368535#M108614</link>
      <description>&lt;P&gt;it seem to be very logical and correct decision, but it still can't find my json string.  splunk return empty result like there is no event. &lt;BR /&gt;
Also I tryied to changed your code ( add commas,  delete string "message.host as to host as from", because "host" is not in "message" ) &lt;BR /&gt;
I don't understand your question about calculating Status. About each minutes I receive data from server if it is "success" connection or "fail". And further want to bring statistic for last 15 minutes. &lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 08:56:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-success-fail-event-and-group-them-by-another-field/m-p/368535#M108614</guid>
      <dc:creator>someguy73</dc:creator>
      <dc:date>2018-01-09T08:56:44Z</dc:date>
    </item>
  </channel>
</rss>

