Developing for Splunk Enterprise

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

View solution in original post

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
Take the 2021 Splunk Career Survey

Help us learn about how Splunk has
impacted your career by taking the 2021 Splunk Career Survey.

Earn $50 in Amazon cash!