Alerting

I'm trying to use makeresults to test an alert but it doesn't work

alexl1
Path Finder

I'm trying to use makeresults to test an alert but it doesn't work because "number of events" is always 0, but I thought the point of makeresults is to always make events?

aberkow
Builder

I'd suggest taking a look at the documentation, Splunk usually offers examples at the bottom of their docs pages https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/Makeresults#Examples. The command doesn't actually create any "events", it looks like. It just creates "statistics" to play around with. For example, if you wanted to alert on something like "what happens when a field has a value of X", you could play around with the syntax like this:

| makeresults count=3
| streamstats count
| eval fieldToAlertOn=case(count=1, "I'm Fine", count=2, "ALERT", count=3, "null")
| search fieldToAlertOn="ALERT"

In this example, I create 3 fake rows, use streamstats to effectively number them, add a field with an eval/case pairing. You can then set this up as an alert and ensure that it successfully triggers, sends the right message to the right location, etc. You can probably extrapolate this to whatever case you need!

richgalloway
SplunkTrust
SplunkTrust

Please share your query.

---
If this reply helps you, Karma would be appreciated.
0 Karma

alexl1
Path Finder

|makeresults

0 Karma

woodcock
Esteemed Legend

That should do it. Are you sure that your alert threshold and other details are configured correctly?

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...