Refine your search:

Ok, so now my app has a scripted input (Powershell) and setup.xml is communicating with an eai endpoint defined inside the app. That's great, but the question is how should I manage the configuration of my scripted input such as target's hostname, user credentials, etc?

My first thought was to keep this information inside a plain xml file and have my script and the endpoint access it. But I guess this solution will make the settings global and won't work scale for multiple users, so I think I'm expected to use *.conf files instead. Plus it adds some inconsistency to the way Splunk keeps its configs.

Going this way to collect the actual config in my script I should not only read a conf file from default\, but also merge it with a conf from local\ and, possibly, respect a conf inside users\someuser\myapp\my.conf. The last part seems confusing to me. How can I tell from my script which user's .conf should I read?

Anyway that's just too many of details to implement in my simple script. I believe there should be a simpler way to manage config without duplicating what Splunk already can do. I guess my script could read the config from my app's EAI endpoint, but for this it needs to authenticate first. If I could pass the script a session key somehow that would be great..

What would you recommend? Just stick with a simple xml? thanks :)

asked 30 Apr '10, 18:14

Leo's gravatar image

Leo ♦
1.1k1313
accept rate: 43%

edited 30 Apr '10, 18:27


3 Answers:

I guess you've already figured this one out since it's more than a month old, but i figured I'd answer in case anyone else wonders.

If you decide to use an .conf you can use splunk's built-in lib to access it, it's in splunk.clilib.cli_common, you can do something like this:

import splunk.clilib.cli_common 
...
settings = splunk.clilib.cli_common.getConfStanza(my_conf_name,wanted_stanza)

The getConfStanza-function returns a dictionary with all your key-value pairs for that stanza.

link

answered 11 Jun '10, 21:52

erydberg's gravatar image

erydberg ♦
2422210
accept rate: 30%

Ah, this might not work for you... Well, if anyone else uses scripted input in python this is a way to solve the problem. :)

(11 Jun '10, 22:03) erydberg ♦

thanks, although I still have no good solution for my case of using a non-python scripted input. By the way, you can also use readConf() from splunk.admin to get .conf data as a dictionary.

(12 Jun '10, 06:13) Leo ♦

Okay, do you know is there any difference between the two ways?

(14 Jun '10, 16:29) erydberg ♦

also looking for some sign of an answer here. I don't want to use scripted input since i have 40+ fields in my setup.xml and i'm guess 100+ saved searches would have to reference a different script each. Is there any way to access these fields directly from the search bar?

link

answered 31 Mar '11, 10:20

klee310's gravatar image

klee310
133112
accept rate: 0%

Perhaps you could leverage the CLI?

splunk btool <config_file> layer <stanza>

link

answered 19 Sep '12, 13:31

melting's gravatar image

melting
46025
accept rate: 29%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×292
×117
×24
×12

Asked: 30 Apr '10, 18:14

Seen: 1,632 times

Last updated: 19 Sep '12, 13:31

Copyright © 2005-2012 Splunk Inc. All rights reserved.