All Apps and Add-ons

Splunk Add-on Builder: How to reference an input's interval setting within a modular input python script?

rleviseur
Explorer

I'm using the Splunk Add-on Builder and building a modular input using my own python code. How can I reference the value of the input's interval setting from within that python script?

Example: If the interval is set to 300 seconds, I'd like to do something in the script like:
myinterval = helper.get_arg('interval')
and have that variable equal 300

0 Karma

bnewcomb79
Explorer
stanza = helper.get_input_stanza()
interval = 30
    if 'interval' in stanza.values()[0]:
    interval = stanza.values()[0]['interval']

Hope this helps 🙂

0 Karma

rleviseur
Explorer

Thanks. I'll give this a shot. Your comment about it just not existing during the tests makes sense.

0 Karma

starcher
SplunkTrust
SplunkTrust

Can't guarantee this. I'd try looking in the contents of helper.get_input_stanza(). You might have to parse it out from there,

0 Karma

rleviseur
Explorer

I thought about that, too.

Oddly enough, the stanza didn't appear to have an interval option/setting. So that didn't work for me. Thanks, though.

0 Karma

bnewcomb79
Explorer

I found that to be the case when running the test since it's a one time thing, but it exists for the actual input.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...