Splunk Search

Server Side Execution

lwalhoefer
Engager

Hi,

does Splunk has a possibility to run server side scripts (python, ruby) based on a splunk search result? The search output should be the input (e.g. a number or list of numbers) for the server side script.

Something like this: ... | fields X | my_server_script X

Thanks!

2 Solutions

dwaddle
SplunkTrust
SplunkTrust

This should be possible by defining a custom search command. Your new search command extends the Splunk search language, and Splunk uses your new command by calling the script that implements it. Some of the existing commands in Splunk (iplocation) are implemented using this facility. These scripts are currently expected to be python scripts. A "runshellscript" command exists in my $SPLUNK_HOME/etc/apps/search/default/commands.conf that looks somewhat interesting.

Your command would receive a stdin dump of the current search results, which you could do as you please with.

Docs at http://www.splunk.com/base/Documentation/latest/SearchReference/Aboutcustomsearchcommands

View solution in original post

piebob
Splunk Employee
Splunk Employee

you could also define a scripted alert that fires off a script using search results when a set condition is met:

http://www.splunk.com/base/Documentation/latest/Admin/Configurescriptedalerts

View solution in original post

piebob
Splunk Employee
Splunk Employee

you could also define a scripted alert that fires off a script using search results when a set condition is met:

http://www.splunk.com/base/Documentation/latest/Admin/Configurescriptedalerts

dwaddle
SplunkTrust
SplunkTrust

This should be possible by defining a custom search command. Your new search command extends the Splunk search language, and Splunk uses your new command by calling the script that implements it. Some of the existing commands in Splunk (iplocation) are implemented using this facility. These scripts are currently expected to be python scripts. A "runshellscript" command exists in my $SPLUNK_HOME/etc/apps/search/default/commands.conf that looks somewhat interesting.

Your command would receive a stdin dump of the current search results, which you could do as you please with.

Docs at http://www.splunk.com/base/Documentation/latest/SearchReference/Aboutcustomsearchcommands

Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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