Splunk Search

How to create alert search using mstats

jstell
Engager

I know that events and metrics use different index types. Does that mean I can't create an alert (outside of metrics workspace) using an SPL search with mstats?
E.g., I am pumping collectd uptime info into splunk. I want to trigger an alert on recent reboots.

| mstats min(_value) as uptime WHERE metric_name="uptime.value" AND "index"="collectd_http" span=120s BY "host"| search uptime < 10000 | stats count by host

This returns statistics results, but does not trigger an alert.

I've found the alert creation functionality in the Metrics Workspace to be somewhat limiting, and wasn't able to get an alert for this condition to work there, either. When I split by host and try to display the "lowest" hosts, it doesn't display the hosts with the lowest uptime value. Also, I haven't found a way to get the metrics alerts to send me the correct host name.

0 Karma
1 Solution

adonio
Ultra Champion

same like any other splunk alert, schedule it, set the trigger condition and thats it ..
stats strips unspecified fields
try this:

| mstats min(_value) as uptime WHERE metric_name="uptime.value" AND "index"="collectd_http" span=120s BY "host"
 | search uptime < 10000 
 | stats min(uptime) as lowest_uptime count_as event_count by host

hope it helps

View solution in original post

0 Karma

jstell
Engager

I figured out that it was an error in my cron expression 😕

Splunk: Please add some UI functionality that tells me when the alert will run.

0 Karma

adonio
Ultra Champion

same like any other splunk alert, schedule it, set the trigger condition and thats it ..
stats strips unspecified fields
try this:

| mstats min(_value) as uptime WHERE metric_name="uptime.value" AND "index"="collectd_http" span=120s BY "host"
 | search uptime < 10000 
 | stats min(uptime) as lowest_uptime count_as event_count by host

hope it helps

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 ...