Splunk Search

How to show output of script to Splunk without indexing it

sieutruc
Contributor

Hello Splunkers,

I have a script that outputs data in tabular form to console.

For exp:

machine state

A ON

B OFF

After that, i get this ouput via python by using:

output=subprocess.check_output("memory.bat", shell=True)

I wrote a function named showoutput.py like search command.
My question is how to show that output above in Splunk without indexing it via a search like:

| script python showoutput memory.bat

In my company, there are a lot of machine, the importance is to catch all their current states in real time. The historic data is already resolved with another tool.

Tags (1)
0 Karma

MHibbin
Influencer

You could set it up as a custom command, that doesn't actually work like the typical custom command.

For example you could create a generic search on "*" and a small time range. Then pipe to your new custom command which runs your script in the background, but it will display the output as results (i.e. anything written to STDOUT).

Quite easy to set a command up, just use the following:

http://docs.splunk.com/Documentation/Splunk/5.0/Search/AddthecustomcommandtoSplunk

Think that is probably the easiest way to just simply plug your script into Splunk. You could probably do a scripted lookup, but that might require you changing the script.

Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...