<?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: Sum of values and max (or last) value in the same query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335670#M170373</link>
    <description>&lt;P&gt;hello there,&lt;BR /&gt;
considering the &lt;CODE&gt;Tot&lt;/CODE&gt; field values are accumulative and accurate you can try something like this maybe:&lt;BR /&gt;
&lt;CODE&gt;... your search ... | stats sum(Pt) as Points max(Tot) as accum_total by Person&lt;/CODE&gt;&lt;BR /&gt;
then apply your alert rule either in search or while saving as an alert.&lt;BR /&gt;
in search &lt;CODE&gt;| where Point!=accum_total&lt;/CODE&gt;&lt;BR /&gt;
in alert &lt;CODE&gt;| search Point!=accum_total&lt;/CODE&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 16:57:05 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2018-04-13T16:57:05Z</dc:date>
    <item>
      <title>Sum of values and max (or last) value in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335668#M170371</link>
      <description>&lt;P&gt;Hello I have to build up a query on Splunk, on wich I am a real newbie.&lt;BR /&gt;
I have a sheet in wich every record contains a name, an event, some points related to the single event and a sum of the points that comes from all the previous events plus the present one.&lt;BR /&gt;
E.G.&lt;BR /&gt;
|Person |Action               |Pt |Tot|&lt;BR /&gt;
|John     |"eats a pie"       | 1 |    1|&lt;BR /&gt;
|John     |"does a jump"  | 3|     4|&lt;BR /&gt;
|John     |"goes to bed"   | 5|     9|&lt;BR /&gt;
|Tim       |"tells a lie"        | 7|  11 |&lt;/P&gt;

&lt;P&gt;The query should show should be something like this&lt;BR /&gt;
|Person |Pt|Tot|&lt;BR /&gt;
|John     |  9|    9|&lt;BR /&gt;
|Tim       |  7|  11|&lt;/P&gt;

&lt;P&gt;As a next step, if the two values does not match (like for Tim), then an alert is raised.&lt;BR /&gt;
What query can I implement?&lt;BR /&gt;
Thank you.&lt;BR /&gt;
Paolo&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 14:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335668#M170371</guid>
      <dc:creator>piretro999</dc:creator>
      <dc:date>2018-04-13T14:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of values and max (or last) value in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335669#M170372</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search which gives fields Person, Action Pt Tot
| stast sum(Pt) as Pt max(Tot) as Tot by Person
| where Pt!=Tot
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can setup alert using this query when "number of events is greater than 0" (means there is a mismatch in Pt and Tot)&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 16:47:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335669#M170372</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-13T16:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of values and max (or last) value in the same query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335670#M170373</link>
      <description>&lt;P&gt;hello there,&lt;BR /&gt;
considering the &lt;CODE&gt;Tot&lt;/CODE&gt; field values are accumulative and accurate you can try something like this maybe:&lt;BR /&gt;
&lt;CODE&gt;... your search ... | stats sum(Pt) as Points max(Tot) as accum_total by Person&lt;/CODE&gt;&lt;BR /&gt;
then apply your alert rule either in search or while saving as an alert.&lt;BR /&gt;
in search &lt;CODE&gt;| where Point!=accum_total&lt;/CODE&gt;&lt;BR /&gt;
in alert &lt;CODE&gt;| search Point!=accum_total&lt;/CODE&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 16:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-of-values-and-max-or-last-value-in-the-same-query/m-p/335670#M170373</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-04-13T16:57:05Z</dc:date>
    </item>
  </channel>
</rss>

