<?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 Calculating fields by groups of events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54699#M13338</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
I need to group events by 3 filelds ip,login and city (one group with same login,same ip and same city),&lt;BR /&gt;
something like this&lt;BR /&gt;
user1 192.168.1.1 London field4...fieldn&lt;BR /&gt;
user1 192.168.1.1 London field4...fieldn&lt;BR /&gt;
user1 192.168.1.1 London field4...fieldn&lt;/P&gt;

&lt;P&gt;user1 2.2.2.2 London field4...fieldn&lt;BR /&gt;
user1 2.2.2.2 London field4...fieldn&lt;BR /&gt;
....&lt;BR /&gt;
user10 4.4.4.4 NY field4...fieldn&lt;BR /&gt;
user10 4.4.4.4 NY field4...fieldn&lt;BR /&gt;
user10 4.4.4.4 NY field4...fieldn&lt;BR /&gt;
after this i need to calculate custom fields INSIDE EVERY GROUP, for example sum of events in group with field4`s value=5 or minimal value of fieldn where field4=12.&lt;BR /&gt;
I tried to use transaction command     &lt;/P&gt;

&lt;P&gt;| transaction ip, login, city&lt;/P&gt;

&lt;P&gt;but I don`t find out how to calculate custom fileds separately for each transaction.&lt;/P&gt;

&lt;P&gt;Also, I was looking at stats command, but as I understood, it`s not possible to use eval command inside stats statement. &lt;/P&gt;

&lt;P&gt;What`s the best way to do it?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2013 15:24:51 GMT</pubDate>
    <dc:creator>andrey2007</dc:creator>
    <dc:date>2013-03-07T15:24:51Z</dc:date>
    <item>
      <title>Calculating fields by groups of events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54699#M13338</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I need to group events by 3 filelds ip,login and city (one group with same login,same ip and same city),&lt;BR /&gt;
something like this&lt;BR /&gt;
user1 192.168.1.1 London field4...fieldn&lt;BR /&gt;
user1 192.168.1.1 London field4...fieldn&lt;BR /&gt;
user1 192.168.1.1 London field4...fieldn&lt;/P&gt;

&lt;P&gt;user1 2.2.2.2 London field4...fieldn&lt;BR /&gt;
user1 2.2.2.2 London field4...fieldn&lt;BR /&gt;
....&lt;BR /&gt;
user10 4.4.4.4 NY field4...fieldn&lt;BR /&gt;
user10 4.4.4.4 NY field4...fieldn&lt;BR /&gt;
user10 4.4.4.4 NY field4...fieldn&lt;BR /&gt;
after this i need to calculate custom fields INSIDE EVERY GROUP, for example sum of events in group with field4`s value=5 or minimal value of fieldn where field4=12.&lt;BR /&gt;
I tried to use transaction command     &lt;/P&gt;

&lt;P&gt;| transaction ip, login, city&lt;/P&gt;

&lt;P&gt;but I don`t find out how to calculate custom fileds separately for each transaction.&lt;/P&gt;

&lt;P&gt;Also, I was looking at stats command, but as I understood, it`s not possible to use eval command inside stats statement. &lt;/P&gt;

&lt;P&gt;What`s the best way to do it?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2013 15:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54699#M13338</guid>
      <dc:creator>andrey2007</dc:creator>
      <dc:date>2013-03-07T15:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating fields by groups of events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54700#M13339</link>
      <description>&lt;P&gt;You could do something like this for your two examples:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eventstats count(eval(field4==5)) as result by ip login city

... | eventstats min(eval(if(field4==12,fieldn,null))) as min by ip login city
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Mar 2013 09:32:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54700#M13339</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-08T09:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating fields by groups of events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54701#M13340</link>
      <description>&lt;P&gt;i made without transaction command&lt;BR /&gt;
1st report&lt;BR /&gt;
...|where field4==12 | stats min(fieldn) by  ip, login, city&lt;BR /&gt;
2nd report&lt;BR /&gt;
...|where field4==5 | stats count(field4) by  ip, login, city&lt;BR /&gt;
but i need it all in one united report&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2013 16:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-fields-by-groups-of-events/m-p/54701#M13340</guid>
      <dc:creator>andrey2007</dc:creator>
      <dc:date>2013-03-11T16:24:26Z</dc:date>
    </item>
  </channel>
</rss>

