Splunk Search

using a batch file or executable as a source of search information

Keith_Holme
Engager

I would like to execute an .exe or .bat file on a windows box and use the stdout as the results in a search. How can this be achieved.

Tags (2)
0 Karma

gallantalex
Path Finder

In your $SPLUNK_HOME\bin\scripts folder you could add another .path file. The .path file which will have one line which is the absolute path to your .exe or .bat file that you want to execute.

Now in Splunk web, go to manager -> data inputs -> scripts and add a new script. Set the command field as the file location of the .path file you created. Fill in all other fields accordingly.

You may have to restart Splunk in order for your changes to occur, I am not certain if that is the case though. I added my scripts by changing the input.conf file instead of using SplunkWeb, and I did have to restart.

Also, you could move your .bat file into $SPLUNK_HOME\bin\scripts folder and access it directly. Not sure if the same goes for an .exe file.

Keith_Holme
Engager

Thanks for the answer to my question.

From my understanding, if I add the script to the search/bin dir in order to perform a search against it I nned to add a stanza to the inputs.conf file. This all seems to work, however, I have to add an interval entry to the stanza (or the system updates the data every 60 seconds). This is not really what I want to do. I wuld really like to get the data strainght from the script and update some controls from that script. I don't want splunk to aggregate the data. Any ideas 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 ...