Splunk Search

Is it possible to create a custom script that is a search command that can take in the search's results?

klim
Path Finder

Is it possible to create a custom script that is a search command that can take in the search's results, do something, and then return the new results to splunk in a different language than python?

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Yes, you can. You can create custom search commands with languages other than Python.

https://dev.splunk.com/enterprise/docs/devtools/customsearchcommands/nonpythonscscs

klim
Path Finder

Are the non custom search commands able to get the results from splunk, manipulate them and create new fields and then send them back to splunk or can I only do logging or send an alert that the search is done?

I was trying to create a script with golang but it keeps saying my command can't find the go.path file which I was copying from the java example that you linked.

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Custom search command are to be used within search pipeline. Typical use case is performing an "external lookup" (for example, calling a whois database).

What you're referring to as sending an alert message is not a custom search command but custom alert action and that's something different.

Did you put the go.path file in the bin directory of your app?

0 Karma

klim
Path Finder

I actually want to use it in the search pipeline for a lookup like your example a whois call. The go.path is in the bin directory of my app.

0 Karma

Stefanie
Builder

Maybe BASH could work?

#!/bin/bash
/opt/splunk/bin/splunk cmd search [object][-parameter <value>]

 https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/CLIsearchsyntax

 

Then add to the script whatever commands you're looking to do something with.

 

0 Karma

klim
Path Finder

That is running everything from the custom script. I need to be able to call the script from the search in splunk instead.

Edit: But I could just wrap the other script inside a python/bash file. 

0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...