<?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: Alert trigger condition on field sum in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517719#M145601</link>
    <description>&lt;P&gt;You could add a running total column and trigger on that exceeding 100&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| streamstats sum(sum) as total&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Sep 2020 12:58:05 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-09-03T12:58:05Z</dc:date>
    <item>
      <title>Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517525#M145532</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I created the following search which reports events of Active Directory users being locked aggregated by username:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="active_directory" sourcetype=XmlWinEventLog source="XmlWinEventLog:Security" EventCode=4740
| stats count BY user&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be notified if the overall amount is above a threshold I want to create an alert on it. Of course I could extend this base search to only have a result if the number of events is above the threshold and trigger the alert if the number of results is greater than one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="active_directory" sourcetype=XmlWinEventLog source="XmlWinEventLog:Security" EventCode=4740
| stats count BY user
| stats sum(count) AS sum
| search sum &amp;gt; 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in this case the alert result would only consist of the number of events. To get the list of the events one would then need to manually run the base search with correct time range.&lt;/P&gt;&lt;P&gt;So I came to the custom trigger condition. As the documentation doesn't tell if it should work, I just tried to use the last two lines as trigger condition:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;stats sum(count) AS sum | search sum &amp;gt; 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately this doesn't seem to work. Does anyone have an idea how this could be solved alternatively?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 16:05:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517525#M145532</guid>
      <dc:creator>diconium</dc:creator>
      <dc:date>2020-09-02T16:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517532#M145534</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;just change the&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;| stats count
| search count &amp;gt; 100&lt;/LI-CODE&gt;&lt;P&gt;to&lt;/P&gt;&lt;LI-CODE lang="java"&gt;| stats count as locked_accounts
| where locked_accounts &amp;gt; 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And then in alert definitions alert if results &amp;gt; 0&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 16:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517532#M145534</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-09-02T16:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517539#M145538</link>
      <description>&lt;P&gt;Have you tried your query as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="active_directory" sourcetype=XmlWinEventLog source="XmlWinEventLog:Security" EventCode=4740
| stats count BY user
| stats sum(count) AS sum, values(_raw) as events&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and your custom trigger as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search sum &amp;gt; 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 16:22:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517539#M145538</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-02T16:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517683#M145589</link>
      <description>&lt;P&gt;All those solutions have only one row in the search result. But I want the search result to consist the amount of events for each user and the alert should only be triggered if the overall sum of events is above the threshold.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 09:42:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517683#M145589</guid>
      <dc:creator>diconium</dc:creator>
      <dc:date>2020-09-03T09:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517692#M145593</link>
      <description>&lt;P&gt;You just need to make your query retrieve all the events without the stats clauses and change your alert so it triggers on the number of results (rather than custom)&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 10:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517692#M145593</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-03T10:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517706#M145597</link>
      <description>&lt;P&gt;That's not what I need. The search result should look like this:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&lt;STRONG&gt;user&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="50.126422250316054%" height="24px"&gt;&lt;STRONG&gt;sum&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;user1&lt;/TD&gt;&lt;TD width="50.126422250316054%" height="24px"&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;user2&lt;/TD&gt;&lt;TD width="50.126422250316054%" height="24px"&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;user3&lt;/TD&gt;&lt;TD width="50.126422250316054%"&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The alert should be triggered if the summary of the second column is above the threshold. But the Splunk users should be able to see the search result to check analyze it without running the search again on their own.&lt;/P&gt;&lt;P&gt;So triggering on the number of results won't work as needed because the threshold will mostly be reached with less results. Applied to the example result set the threshold of 100 is reached but there are only 3 results.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 11:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517706#M145597</guid>
      <dc:creator>diconium</dc:creator>
      <dc:date>2020-09-03T11:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517719#M145601</link>
      <description>&lt;P&gt;You could add a running total column and trigger on that exceeding 100&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| streamstats sum(sum) as total&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 12:58:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/517719#M145601</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-03T12:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Alert trigger condition on field sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/523368#M147605</link>
      <description>&lt;P&gt;Finally I solved it using &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;eventstats&lt;/FONT&gt;&lt;/STRONG&gt; &lt;/FONT&gt;which creates new field for the total sum:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="active_directory" sourcetype=XmlWinEventLog source="XmlWinEventLog:Security" EventCode=4740
| stats count BY user
| eventstats sum(count) AS total_amount
| search total_amount &amp;gt; 100&lt;/LI-CODE&gt;&lt;P&gt;The result of this search looks like this:&lt;/P&gt;&lt;TABLE border="1" width="100.2517507368504%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;&lt;STRONG&gt;user&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25.063211125158027%" height="24px"&gt;&lt;STRONG&gt;count&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25.063211125158027%"&gt;&lt;STRONG&gt;total_amount&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;user1&lt;/TD&gt;&lt;TD width="25.063211125158027%" height="24px"&gt;45&lt;/TD&gt;&lt;TD width="25.063211125158027%"&gt;103&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="24px"&gt;user2&lt;/TD&gt;&lt;TD width="25.063211125158027%" height="24px"&gt;27&lt;/TD&gt;&lt;TD width="25.063211125158027%"&gt;103&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;user3&lt;/TD&gt;&lt;TD width="25.063211125158027%"&gt;31&lt;/TD&gt;&lt;TD width="25.063211125158027%"&gt;103&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Afterwards I can filter by its value using the threshold value (e.g. 100). So there will be results only if the total_amount exceeds the theshold.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 07:55:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Alert-trigger-condition-on-field-sum/m-p/523368#M147605</guid>
      <dc:creator>diconium</dc:creator>
      <dc:date>2020-10-07T07:55:56Z</dc:date>
    </item>
  </channel>
</rss>

