Splunk Search

How to set-up alert on splunk that notifies on occurrence of set of strings above threshold value

ma_anand1984
Contributor

Its quite natural for any of us to look for occurrence of a set of strings. It will be necessary to send alert only if it exceeds threshold limit.
What is the best way to achieve it?

0 Karma
1 Solution

ma_anand1984
Contributor

This question is extension of the question asked here
http://splunk-base.splunk.com/answers/61664/search-set-of-strings-from-lookup-and-list-count-of-occu...

Assumption

  1. Lookup file should be in below format
  2. first column should have plain non special single valued search string
  3. second column should have above said search string followed by and underscore and threshold limit
  4. threshold limit should be in two digit (if three digit is need make it three but make a change in query)
  5. | eval fooC = tonumber(substr(foo,-2)) to | eval fooC = tonumber(substr(foo,-3))

All other assumptions mentioned in the question in link above holds good

yourStringFieldName,yourStringFieldNameTwo
search_string_A,search_string_A_05
search_string_B,search_string_B_10
search_string_C,search_string_C_05

Actual command



[| inputlookup your_lookup_here | rename yourStringFieldName as search | fields search | format]
| rename _raw as rawText
| eval foo=[| inputlookup your_lookup_here | stats values(yourStringFieldNameTwo) as query | eval query=mvjoin(query,",")
| fields query
| eval query="\"".query."\"" ]
| eval foo=split(foo,",")
| mvexpand foo
| eval rawText=lower(rawText)
| where like(rawText,"%"+lower(substr(foo,1,len(foo)-3))+"%")
| eval fooC = tonumber(substr(foo,-2))
| eval foo = substr(foo,1,len(foo)-3)
| stats count by foo fooC
| where count >= fooC

View solution in original post

0 Karma

ma_anand1984
Contributor

This question is extension of the question asked here
http://splunk-base.splunk.com/answers/61664/search-set-of-strings-from-lookup-and-list-count-of-occu...

Assumption

  1. Lookup file should be in below format
  2. first column should have plain non special single valued search string
  3. second column should have above said search string followed by and underscore and threshold limit
  4. threshold limit should be in two digit (if three digit is need make it three but make a change in query)
  5. | eval fooC = tonumber(substr(foo,-2)) to | eval fooC = tonumber(substr(foo,-3))

All other assumptions mentioned in the question in link above holds good

yourStringFieldName,yourStringFieldNameTwo
search_string_A,search_string_A_05
search_string_B,search_string_B_10
search_string_C,search_string_C_05

Actual command



[| inputlookup your_lookup_here | rename yourStringFieldName as search | fields search | format]
| rename _raw as rawText
| eval foo=[| inputlookup your_lookup_here | stats values(yourStringFieldNameTwo) as query | eval query=mvjoin(query,",")
| fields query
| eval query="\"".query."\"" ]
| eval foo=split(foo,",")
| mvexpand foo
| eval rawText=lower(rawText)
| where like(rawText,"%"+lower(substr(foo,1,len(foo)-3))+"%")
| eval fooC = tonumber(substr(foo,-2))
| eval foo = substr(foo,1,len(foo)-3)
| stats count by foo fooC
| where count >= fooC

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...