Splunk Dev

What's the advantage of using __GETINFO__ in custom search scripts?

Lowell
Super Champion

I've written a few custom searches scripts and some of them have used getinfo, and other have not. (Probably based on whichever example I was starting from.)

Can anyone give some insight into what the advantages/disadvantages to using the getinfo feature in custom search scripts? (Possibly some examples where one would be preferable over the other?)

The Custom search commands docs do explain a little bit, but I was hoping for some additional use cases or examples.

Does splunk recommend that newly written scripts use this feature?

0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

Seems mostly not that useful, as you have to provide a commands.conf entry for your script to set supports_getinfo anyway. I guess it's handy if you think you might update the script to change its settings and save yourself updating the conf file, but honestly, it seems like it's easier to just set the values in the commands.conf file.

The biggest advantage is just that you can stop the search early if the arguments to your script aren't good, but while nice, that's not really that major an advantage. There's some unlikely cases where you script might use different settings dynamically, but that seems like a real stretch.

View solution in original post

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

Seems mostly not that useful, as you have to provide a commands.conf entry for your script to set supports_getinfo anyway. I guess it's handy if you think you might update the script to change its settings and save yourself updating the conf file, but honestly, it seems like it's easier to just set the values in the commands.conf file.

The biggest advantage is just that you can stop the search early if the arguments to your script aren't good, but while nice, that's not really that major an advantage. There's some unlikely cases where you script might use different settings dynamically, but that seems like a real stretch.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...