Knowledge Management

How can I create an External Lookup that does not create a CSV but displays the results?

danfein
New Member

I am looking to run a python script that will take the results of several API calls and make them into something that Splunk displays as if the data were retrieved from its own indexing.

Is it possible to run on the fly queries like this?:

Search in Splunk >
External lookup is triggered >
apidata.py is invoked >
Data returned in some way to Splunk >
Displayed in Splunk

I believe this is possible, but the only way I have seen it thus far has been with CSVs, but the data returned will be high.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

HI @danfein,

I think Splunk Custom command will help you. You just create a custom command and write some python code to call APIs and display values as a result. There are few links which can be helpful you to create custom command.

http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Search/Writeasearchcommand
https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Search/Customsearchcommandshape
http://dev.splunk.com/view/python-sdk/SP-CAAAEU2
https://www.splunk.com/blog/2014/04/14/building-custom-search-commands-in-python-part-i-a-simple-gen...

Thanks

nickhills
Ultra Champion

You want to use a scripted input.
http://docs.splunk.com/Documentation/Splunk/7.0.1/AdvancedDev/ScriptSetup

This is very common and is simple to do. You can make you life even easier if your script returns a date and key=value pairs as its response, as Splunk would need no further extractions to fully interpret and index your data.

If my comment helps, please give it a thumbs up!
0 Karma

danfein
New Member

This doesn't look like something that would take in a custom query from Splunk, am I mistaken?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...