<?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 create alert with customized limits for many agents? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302276#M5433</link>
    <description>&lt;P&gt;I think you'd be best served using a lookup table to define the limits, then filtering those where the count is greater than the limit with &lt;CODE&gt;where&lt;/CODE&gt;.  Example configuration below.&lt;/P&gt;

&lt;P&gt;agent_limits.csv:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;agent,limit
nfc*,700
mm_write,5000
breeze,1500
megafon_bitmap,1000
bankm_cashback,5000
*,7000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[agent_limits]
filename = agent_limits.csv
match_type = WILDCARD(agent)
max_matches = 1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run anywhere search demonstrating functionality:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval agent="nfc1", count=650
| append [| makeresults | eval agent="nfc2", count=750]
| append [| makeresults | eval agent="breeze", count=5001]
| lookup agent_limits agent OUTPUT limit
| where count&amp;gt;=limit
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The key components are &lt;CODE&gt;match_type = WILDCARD(agent)&lt;/CODE&gt; in transforms.conf and &lt;CODE&gt;*,7000&lt;/CODE&gt;.  The former tells Splunk that it should treat &lt;CODE&gt;*&lt;/CODE&gt; in a lookup file as a wildcard and thus allow partial matches.  The latter is a default limit, applied when no other agent matched.  That default lookup needs to be last in the lookup file.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jan 2018 14:55:32 GMT</pubDate>
    <dc:creator>micahkemp</dc:creator>
    <dc:date>2018-01-11T14:55:32Z</dc:date>
    <item>
      <title>How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302274#M5431</link>
      <description>&lt;P&gt;I need to be alerted that the agent is exceeding its specified limit, and if the agent limit is not set, then the base limit triggered&lt;/P&gt;

&lt;P&gt;To atchive that I have created such search string for alert&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;index=api | stats count as c by agent | search  (agent=nfc* c&amp;gt;700) OR (agent=mm_write c&amp;gt;5000) OR (agent=breeze c&amp;gt;1500) OR (agent=megafon_bitmap c &amp;gt; 1000) OR (agent=bankm_cashback с&amp;gt;5000)  OR (agent!=breeze agent!=nfc* agent!=mm_write agent!=bankm_cashback agent!=megafon_bitmap c&amp;gt;700)  
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But it looks too cumbersome&lt;/P&gt;

&lt;P&gt;Is there better way to do this?&lt;BR /&gt;
I would like to maintain some kind of table of agents limits. &lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:00:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302274#M5431</guid>
      <dc:creator>exmuzzy</dc:creator>
      <dc:date>2018-01-11T14:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302275#M5432</link>
      <description>&lt;P&gt;perhaps you can try something like this&lt;BR /&gt;
its the same just took like terms together&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=api | stats count as c by agent | search  (((agent!=breeze agent!=nfc* agent!=mm_write agent!=bankm_cashback agent!=megafon_bitmap) OR agent=nfc*) c&amp;gt;700) OR ((agent=mm_write OR agent=bankm_cashback) c&amp;gt;5000) OR (agent=breeze c&amp;gt;1500) OR (agent=megafon_bitmap c&amp;gt;1000) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302275#M5432</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-11T14:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302276#M5433</link>
      <description>&lt;P&gt;I think you'd be best served using a lookup table to define the limits, then filtering those where the count is greater than the limit with &lt;CODE&gt;where&lt;/CODE&gt;.  Example configuration below.&lt;/P&gt;

&lt;P&gt;agent_limits.csv:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;agent,limit
nfc*,700
mm_write,5000
breeze,1500
megafon_bitmap,1000
bankm_cashback,5000
*,7000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[agent_limits]
filename = agent_limits.csv
match_type = WILDCARD(agent)
max_matches = 1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run anywhere search demonstrating functionality:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval agent="nfc1", count=650
| append [| makeresults | eval agent="nfc2", count=750]
| append [| makeresults | eval agent="breeze", count=5001]
| lookup agent_limits agent OUTPUT limit
| where count&amp;gt;=limit
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The key components are &lt;CODE&gt;match_type = WILDCARD(agent)&lt;/CODE&gt; in transforms.conf and &lt;CODE&gt;*,7000&lt;/CODE&gt;.  The former tells Splunk that it should treat &lt;CODE&gt;*&lt;/CODE&gt; in a lookup file as a wildcard and thus allow partial matches.  The latter is a default limit, applied when no other agent matched.  That default lookup needs to be last in the lookup file.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:55:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302276#M5433</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-11T14:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302277#M5434</link>
      <description>&lt;P&gt;Is there a way to create agent_limits.csv from the splunk web?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 15:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302277#M5434</guid>
      <dc:creator>exmuzzy</dc:creator>
      <dc:date>2018-01-11T15:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302278#M5435</link>
      <description>&lt;P&gt;You can add lookups via Splunk Web, but you can't add the transforms I suggested via Web.  Is this in Splunk Cloud, where there is no CLI access?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 16:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302278#M5435</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-11T16:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302279#M5436</link>
      <description>&lt;P&gt;It works perfectly! Many thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 06:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302279#M5436</guid>
      <dc:creator>exmuzzy</dc:creator>
      <dc:date>2018-01-12T06:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302280#M5437</link>
      <description>&lt;P&gt;2micahkemp: can you hint me how to calculate limits for agents based on their regular activity?&lt;BR /&gt;
I mean,  how to generate agent_limits.csv based on previous events automativcaly not manualy?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:25:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302280#M5437</guid>
      <dc:creator>exmuzzy</dc:creator>
      <dc:date>2018-01-12T17:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302281#M5438</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;| outputlookup&lt;/CODE&gt; to write search results to a lookup file, which would allow you to create it programmatically.  My sample lookup file could have been produced by this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval agent="nfc*", limit=700
| append [| makeresults | eval agent="mm_write", limit=5000]
| append [| makeresults | eval agent="breeze", limit=1500]
| append [| makeresults | eval agent="megafon_bitmap", limit=1000]
| append [| makeresults | eval agent="bankm_cashback", limit=5000]
| append [| makeresults | eval agent="*", limit=7000]
| fields - _time
| outputlookup agent_limits.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the logic that determines what those limits should be based on your data, I don't know how to help you there.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 17:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302281#M5438</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-12T17:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create alert with customized limits for many agents?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302282#M5439</link>
      <description>&lt;P&gt;Thanks a lot!&lt;BR /&gt;
I've created another question on this topic&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/611366/how-to-calculate-limits-for-agents-based-on-their.html"&gt;https://answers.splunk.com/answers/611366/how-to-calculate-limits-for-agents-based-on-their.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 20:13:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-alert-with-customized-limits-for-many-agents/m-p/302282#M5439</guid>
      <dc:creator>exmuzzy</dc:creator>
      <dc:date>2018-01-12T20:13:41Z</dc:date>
    </item>
  </channel>
</rss>

