Knowledge Management

Realtime search based on macro and changing the macro

phoenixdigital
Builder

Hi All,

We have a realtime search which will fire alerts based on some thresholds which we currently store in macros

So I will dumb down the realtime savedsearch as an example

sourcetype="myData" | head 2 | eval testMacro = `macroThreshold` | where testMacro > 120

We have setup page for our app which allows modification of these macros (can also be done via management)

macros.conf looks something like this

[macroThreshold]
definition = 100

Now the saved search is a realtime search and we are hoping that if someone changes the definition of macroThreshold it will be updated in the realtime search. This doesnt appear to work and it appears to be fixed as the value the macro was when the search was started.

Does anyone have an alternate way for changing this threshold and having it used by the realtime search?

A subsearch will not work as you cannot have realtime subsearches.

Is there a way to force/kill the realtime search to restart using this new value?

Tags (2)

dwaddle
SplunkTrust
SplunkTrust

I've not tested it but a lookup might work. Say you have a lookup threshold.csv defined as

sourcetype,threshold
myData,100

Then your realtime search can be written as

sourcetype="myData" 
| head 2 
| lookup update=true threshold.csv sourcetype OUTPUT threshold
| where threshold > 120

The update=true will explicitly cause realtime searches to pull in updates to the lookup.

Sadly there is probably no good way to manage the lookup file from manager directly.

0 Karma

phoenixdigital
Builder

Ah nice to know about lookup and realtime searches thanks.

As you stated its probably not ideal as it means we need some other interface (possibly external to Splunk) for updating the CSV file.

I suppose I could alter the setup_handler.py to do it though.

Ideally though a way to kick a saved realtime search into restarting would be great.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...