Splunk Dev

How can I retrieve a value from inputs.conf file and use it inside a python script lookup?

dhruvisha2345
Engager

Hello,

I want to fetch the value present in the inputs.conf file(/Splunk/etc/apps/$app/local), ie:

[stanza-name]
value-name = value

How can I retrieve this value and use it inside a python lookup script (stored in /Splunk/etc/apps/$app/bin)?

thanks,

Labels (1)
Tags (2)
0 Karma

deepakc
Builder

Sounds like you need to to in your custom python script - create a function / code that looks at the inputs file for the key=value as a variable and use that

This is a simple test that you can get the value you want - but you will have to dev the code in your python script

python3 -c 'print(open("/Splunk/etc/apps/$app/local/inputs.conf").read())' | grep 'value-name = value'



Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...