<?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 filter success/fail status when using data model in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211236#M61759</link>
    <description>&lt;P&gt;I want to calculate successRate for a combination of hotelId and useId with data model.&lt;BR /&gt;
It works with following query. But the problem is that the query runs really slowly due to the join command.&lt;/P&gt;

&lt;P&gt;Query: &lt;BR /&gt;
|tstats count as Total from datamodel="xxx" by hotelId, useId | join ... [|tstats count AS Failed from datamodel="xxx" where status=false by hotelId, useId|...&lt;/P&gt;

&lt;P&gt;How can I count the Total and Failed with only one "tstats"? It there any command similar with "count(eval(status=false))"?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Dec 2015 11:08:54 GMT</pubDate>
    <dc:creator>amylala</dc:creator>
    <dc:date>2015-12-30T11:08:54Z</dc:date>
    <item>
      <title>How to filter success/fail status when using data model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211236#M61759</link>
      <description>&lt;P&gt;I want to calculate successRate for a combination of hotelId and useId with data model.&lt;BR /&gt;
It works with following query. But the problem is that the query runs really slowly due to the join command.&lt;/P&gt;

&lt;P&gt;Query: &lt;BR /&gt;
|tstats count as Total from datamodel="xxx" by hotelId, useId | join ... [|tstats count AS Failed from datamodel="xxx" where status=false by hotelId, useId|...&lt;/P&gt;

&lt;P&gt;How can I count the Total and Failed with only one "tstats"? It there any command similar with "count(eval(status=false))"?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 11:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211236#M61759</guid>
      <dc:creator>amylala</dc:creator>
      <dc:date>2015-12-30T11:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter success/fail status when using data model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211237#M61760</link>
      <description>&lt;P&gt;Have you tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count as Total from datamodel="xxx" by hotelId, useId, status 
| addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;[EDITED]&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count as Total from datamodel="xxx" by hotelId, useId, status 
| eval Fail = if(Status="fail", Total, 0)
| stats sum(Total) as TotalCount, sum(Fail) as FailCount by hotelId, useId
| eval SuccessRate = (FailCount/TotalCount)*100 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Dec 2015 11:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211237#M61760</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2015-12-30T11:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter success/fail status when using data model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211238#M61761</link>
      <description>&lt;P&gt;You can try addcoltotals too to see which one works better for you&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 11:23:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211238#M61761</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2015-12-30T11:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter success/fail status when using data model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211239#M61762</link>
      <description>&lt;P&gt;Thanks, javiergn. &lt;BR /&gt;
addtotals and addcoltotals do not work for me.&lt;/P&gt;

&lt;P&gt;What i want is: &lt;BR /&gt;
hotelId useId   TotalCount  FailCount   Success%&lt;BR /&gt;
12345   111 100 2   98&lt;BR /&gt;
12345   112 150 100 33.33&lt;/P&gt;

&lt;P&gt;But here is what i get with addtotals.&lt;/P&gt;

&lt;P&gt;hotelId useId   Status  Total&lt;BR /&gt;
12345   111 success 98&lt;BR /&gt;
12345   111 fail    2&lt;BR /&gt;
12345   112 success 50&lt;BR /&gt;
12345   112 fail    100&lt;/P&gt;

&lt;P&gt;Do you know how to convert this table to the one i expected?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 03:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211239#M61762</guid>
      <dc:creator>amylala</dc:creator>
      <dc:date>2015-12-31T03:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter success/fail status when using data model</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211240#M61763</link>
      <description>&lt;P&gt;I see, then try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count as Total from datamodel="xxx" by hotelId, useId, status 
| eval Fail = if(Status="fail", Total, 0)
| stats sum(Total) as TotalCount, sum(Fail) as FailCount by hotelId, useId
| eval SuccessRate = (FailCount/TotalCount)*100 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Dec 2015 09:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-success-fail-status-when-using-data-model/m-p/211240#M61763</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2015-12-31T09:38:42Z</dc:date>
    </item>
  </channel>
</rss>

