Splunk Dev

Is the installation of Splunk Python SDK essential to build custom commands?

kcnolan13
Communicator

This presentation (towards the end) shows the Splunk Python SDK being used to build a custom search command. Is installation of the Python SDK required to build custom search commands? I need to build a custom streaming command for a Splunk instance with limited external internet access. If the Python SDK is essential, is there another way to install it other than using pip?

I'd also like to see two examples of custom command protocols V1 vs V2. I see that V2 boasts performance improvements, and I am trying to analyze some existing code for an add-on to figure out if it is using V1 or V2.

Thanks for the help!

0 Karma
1 Solution

aljohnson_splun
Splunk Employee
Splunk Employee

Hi @Kcnolan13,

Is installation of the Python SDK required to build custom search commands?

No, it isn't, but its recommended. The SDK has already gotten a lot of the nitty gritty low level details out of the way for you, and has made it really easy to write a custom search command using this new protocol. However, at the end of presentation you mentioned, you'll see that V2 detailed specification is available by request. With some work, you can use an arbitrary programing language to exchange data via the chunked external command protocol.

I need to build a custom streaming command for a Splunk instance with limited external internet access. If the Python SDK is essential, is there another way to install it other than using pip?

No, it isn't essential, but is going to be a lot easier to use the SDK. Yes, there are multiple ways to install it, such as easy_install or using the setup.py script. See http://dev.splunk.com/view/python-sdk/SP-CAAAEDG

I'd also like to see two examples of custom command protocols V1 vs V2. I see that V2 boasts performance improvements, and I am trying to analyze some existing code for an add-on to figure out if it is using V1 or V2.

An exmaple of V1 (Intersplunk) : the "shape" command on this page: http://dev.splunk.com/view/python-sdk/SP-CAAAEU2
Some examples of V2 can be found here: https://github.com/splunk/splunk-sdk-python/tree/master/examples/searchcommands_app

View solution in original post

aljohnson_splun
Splunk Employee
Splunk Employee

Hi @Kcnolan13,

Is installation of the Python SDK required to build custom search commands?

No, it isn't, but its recommended. The SDK has already gotten a lot of the nitty gritty low level details out of the way for you, and has made it really easy to write a custom search command using this new protocol. However, at the end of presentation you mentioned, you'll see that V2 detailed specification is available by request. With some work, you can use an arbitrary programing language to exchange data via the chunked external command protocol.

I need to build a custom streaming command for a Splunk instance with limited external internet access. If the Python SDK is essential, is there another way to install it other than using pip?

No, it isn't essential, but is going to be a lot easier to use the SDK. Yes, there are multiple ways to install it, such as easy_install or using the setup.py script. See http://dev.splunk.com/view/python-sdk/SP-CAAAEDG

I'd also like to see two examples of custom command protocols V1 vs V2. I see that V2 boasts performance improvements, and I am trying to analyze some existing code for an add-on to figure out if it is using V1 or V2.

An exmaple of V1 (Intersplunk) : the "shape" command on this page: http://dev.splunk.com/view/python-sdk/SP-CAAAEU2
Some examples of V2 can be found here: https://github.com/splunk/splunk-sdk-python/tree/master/examples/searchcommands_app

kcnolan13
Communicator

Thanks! So does this mean there are / will be a lot of Splunk extensions that won't work until you install the Python SDK? So far, I haven't encountered any apps with that dependency.... but this makes it seem like it would be a common requirement baked into most apps that offer custom commands.

0 Karma

aljohnson_splun
Splunk Employee
Splunk Employee

Not necessarily a "dependency", but rather, just packaged within the app. So its not that you have to separately install the SDK for the app using a custom search command, but rather, the app developer should put all the dependencies in the app.

See http://dev.splunk.com/view/python-sdk/SP-CAAAEU2#template for a list of instructions of what you would do to put the needed components into the app of your choosing for your own custom search command.

0 Karma

kcnolan13
Communicator

Thanks for the link! How exactly would you bundle the SDK with the app? Is there a standard way of doing this? I could have missed it, but I didn't see that addressed specifically in the article.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...