<?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 edit my search to get the count of a decision field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333661#M99220</link>
    <description>&lt;P&gt;I tried the query and the results are either 1 or 0 . &lt;/P&gt;

&lt;P&gt;i also tried with another numerical field " reasonCode" ( like below) , but same results.&lt;/P&gt;

&lt;P&gt;| stats count(eval(reasonCode="100")) as ACCEPTED by BATCHID&lt;/P&gt;

&lt;P&gt;sample output&lt;BR /&gt;
ACCEPTED&lt;BR /&gt;
1&lt;BR /&gt;&lt;BR /&gt;
1            &lt;/P&gt;</description>
    <pubDate>Thu, 20 Apr 2017 06:42:14 GMT</pubDate>
    <dc:creator>sukundur</dc:creator>
    <dc:date>2017-04-20T06:42:14Z</dc:date>
    <item>
      <title>How to edit my search to get the count of a decision field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333657#M99216</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
I am trying to get the count if a field decision="ACCEPT"  or decision="REJECT" by merchant and his ID , but count only return 1 or 0. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch ....  
| transaction alp_batchid startswith="Got file to process: /var/mware/alp/validated" endswith="processed successfully" 
|rename alp_merchantid as MERCHANTID,alp_batchid as BATCHID,olp_batch_amount as BATCH_AMOUNT,alp_batch_start_time as START_TIME,alp_batch_end_time as END_TIME 
| eval msg_accepted=if(decision="ACCEPT", 1, 0) | eval msg_rejected=if(decision="REJECT", 1, 0)  
|eventstats sum(msg_accepted) as ACCEPTED, sum(msg_rejected) as REJECTED,dc(requestID) as BATCH_RECORD_CNT by MERCHANTID,BATCHID  
| table MERCHANTID, BATCHID,BATCH_RECORD_CNT,ACCEPTED,REJECTED,START_TIME,END_TIME,BATCH_DURATION
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Issue : ACCEPTED and REJECTED fields are either 1/0.&lt;/P&gt;

&lt;P&gt;I am trying to use below function to get the count of decision="ACCEPT" or decision="REJECT" but they return either 1 or 0 where there are a total of 100+&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval msg_accepted=if(decision="ACCEPT", 1, 0) | eval msg_rejected=if(decision="REJECT", 1, 0) 
|eventstats sum(msg_accepted) as ACCEPTED, sum(msg_rejected) as REJECTED,dc(requestID) as BATCH_RECORD_CNT by MERCHANTID,BATCHID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 23:13:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333657#M99216</guid>
      <dc:creator>sukundur</dc:creator>
      <dc:date>2017-04-18T23:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to get the count of a decision field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333658#M99217</link>
      <description>&lt;P&gt;Why are you building a transaction? I can't tell if you are using it or not. Are you sure that ACCEPT and REJECT are capitalized in the data, and that the decision field actually exists?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 04:02:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333658#M99217</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-04-19T04:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to get the count of a decision field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333659#M99218</link>
      <description>&lt;P&gt;Perhaps this will be what you want&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch ....  
| stats count(eval(decision=="ACCEPT")) as ACCEPTED count(eval(decision=="REJECT")) as REJECTED  
dc(requestID) as BATCH_RECORD_CNT by alp_merchantid alp_batchid  alp_batch_start_time alp_batch_end_time
|rename alp_merchantid as MERCHANTID, alp_batchid as BATCHID, olp_batch_amount as BATCH_AMOUNT, 
alp_batch_start_time as START_TIME, alp_batch_end_time as END_TIME 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2017 04:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333659#M99218</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-04-19T04:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to get the count of a decision field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333660#M99219</link>
      <description>&lt;P&gt;yes they are capitals. &lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 05:31:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333660#M99219</guid>
      <dc:creator>sukundur</dc:creator>
      <dc:date>2017-04-20T05:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to get the count of a decision field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333661#M99220</link>
      <description>&lt;P&gt;I tried the query and the results are either 1 or 0 . &lt;/P&gt;

&lt;P&gt;i also tried with another numerical field " reasonCode" ( like below) , but same results.&lt;/P&gt;

&lt;P&gt;| stats count(eval(reasonCode="100")) as ACCEPTED by BATCHID&lt;/P&gt;

&lt;P&gt;sample output&lt;BR /&gt;
ACCEPTED&lt;BR /&gt;
1&lt;BR /&gt;&lt;BR /&gt;
1            &lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 06:42:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-count-of-a-decision-field/m-p/333661#M99220</guid>
      <dc:creator>sukundur</dc:creator>
      <dc:date>2017-04-20T06:42:14Z</dc:date>
    </item>
  </channel>
</rss>

