<?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: stats on transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117971#M31433</link>
    <description>&lt;P&gt;Correct.  It's best to avoid &lt;CODE&gt;transaction&lt;/CODE&gt; when you can.  It is very resource intensive, and easy to have problems with.  &lt;/P&gt;

&lt;P&gt;To relate the values to each other, and to get a sum of how many total times the Animal ate, you could also  break it out like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=animalfood
 | stats count as mycount by Animal, Food
 | eval foodcount=Food."=".mycount
 | stats values(foodcount) as FoodDetails, dc(Food) as FoodTypeCount, sum(mycount) as MealCount  by Animal
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 18 May 2017 20:41:12 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-05-18T20:41:12Z</dc:date>
    <item>
      <title>stats on transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117967#M31429</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I wonder about how can I do stats operation like counting of something inside of a transaction?&lt;/P&gt;

&lt;P&gt;I have a transaction including multiple events of the same kind (or multiple kinds), I would like to make a table, listing all the transactions including the count of certain events.&lt;/P&gt;

&lt;P&gt;Do you have any hints?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Peter&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2014 08:40:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117967#M31429</guid>
      <dc:creator>psobisch</dc:creator>
      <dc:date>2014-01-17T08:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: stats on transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117968#M31430</link>
      <description>&lt;P&gt;The thing about &lt;CODE&gt;transaction&lt;/CODE&gt; is that it removes the individual events, so since the concepts of the previously existing individual events is gone it's tricky to do stats "per event". You could either calculate your statistics before running &lt;CODE&gt;transaction&lt;/CODE&gt;, or you could use &lt;CODE&gt;eval&lt;/CODE&gt; functions like &lt;CODE&gt;mvcount&lt;/CODE&gt; for getting counts within multivalued fields that are created as part of the transaction. It's hard to give more specific advice without knowing more about your exact scenario.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2014 09:55:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117968#M31430</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2014-01-17T09:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: stats on transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117969#M31431</link>
      <description>&lt;P&gt;ok thanks, that's what I did now.&lt;BR /&gt;
Works well, but I would like to have searches which are not so extensive.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2014 08:08:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117969#M31431</guid>
      <dc:creator>psobisch</dc:creator>
      <dc:date>2014-01-23T08:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: stats on transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117970#M31432</link>
      <description>&lt;P&gt;If this is something you can accomplish with stats and not transaction, I've found a way to do it.&lt;BR /&gt;
It appears that psobisch's original problem was solved, but in case anyone lands here from a search like I did, here you go.&lt;/P&gt;

&lt;P&gt;Let's say I have a dataset that records every time an Animal eats a certain type of Food. Multiple Animals eat multiple types of Food.&lt;BR /&gt;
My first search to make a full list of each time an Animal eats Food was this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=animalfood
| transaction Animal mvlist=t
| table *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then, I wanted to count and list, by Animal, how many times they ate each kind of food. Keeping the multivalue format was important - I only wanted each Animal listed once.&lt;/P&gt;

&lt;P&gt;I was able to uses &lt;CODE&gt;stats&lt;/CODE&gt; twice to accomplish what I wanted.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=animalfood
| stats count by Animal, Food
| stats list(Food) list(count) by Animal
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first &lt;CODE&gt;stats&lt;/CODE&gt; creates the Animal, Food, count pairs.&lt;BR /&gt;
The second &lt;CODE&gt;stats&lt;/CODE&gt; creates the multivalue table associating the Food, count pairs to each Animal.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 18:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117970#M31432</guid>
      <dc:creator>mstark31</dc:creator>
      <dc:date>2017-05-18T18:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: stats on transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117971#M31433</link>
      <description>&lt;P&gt;Correct.  It's best to avoid &lt;CODE&gt;transaction&lt;/CODE&gt; when you can.  It is very resource intensive, and easy to have problems with.  &lt;/P&gt;

&lt;P&gt;To relate the values to each other, and to get a sum of how many total times the Animal ate, you could also  break it out like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=animalfood
 | stats count as mycount by Animal, Food
 | eval foodcount=Food."=".mycount
 | stats values(foodcount) as FoodDetails, dc(Food) as FoodTypeCount, sum(mycount) as MealCount  by Animal
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 20:41:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117971#M31433</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-05-18T20:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: stats on transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117972#M31434</link>
      <description>&lt;P&gt;Different approach - but cool way to solve the problem.&lt;BR /&gt;
Also works.&lt;/P&gt;

&lt;P&gt;I've also done a chart variation with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=animalfood
| chart count by Animal, Food limit=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 21:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-on-transaction/m-p/117972#M31434</guid>
      <dc:creator>mstark31</dc:creator>
      <dc:date>2017-05-18T21:20:03Z</dc:date>
    </item>
  </channel>
</rss>

