Getting Data In
Highlighted

setup.xml to modify/create an entry in app.conf (or anywhere else)

Hi,

I've been trying to make a basic setup.xml that can create a stanza and config that I can access from a scripted input (Python)

I know how to pull data out of a configuration file via the REST interface.

What I can't do is a simple setup.xml such as this to create/modify an entry in app.conf

<setup>
    <block title="Proxy Server for API calls" endpoint="configs/conf-app" >

      <input field="proxy_server_username">
        <label>Username</label>
        <type>text</type>
      </input>
    </block>
</setup>

I've built custom setup.xml files before and made my own endpoint but I was trying to just use the existing Splunk REST endpoints to just add this to app.conf.

Is it possible or do I have to make a custom endpoint?

Tags (2)
Highlighted

Re: setup.xml to modify/create an entry in app.conf (or anywhere else)

Explorer

Perhaps just use the inbuilt passwords.conf endpoint e.g.

<setup>
  <block title="Proxy Server for API calls" endpoint="storage/passwords" entity="_new">
    <input field="name">
      <label>Username</label>
      <type>text</type>
    </input>
    <input field="password">
      <label>Password</label>
      <type>password</type>
    </input>
  </block>
 </setup>
0 Karma
Highlighted

Re: setup.xml to modify/create an entry in app.conf (or anywhere else)

Thanks for the info I have that in my configuration an excluded it from my example because that part worked.

Unfortunately there are a few issues with this method.

This only ever allows you to set it once. If you try to update the username/password it will return an error.

Also when I go to use this stored password from another modular input I need to know the username when calling the REST interface. So I have a few choices here. I hardcode in the username into the python code for the modular input which sort of defeats the purpose of having a setup page.

I'm going down the route of making a custom endpoint which will do the following

  1. Store the username and proxy server address in a custom.conf
  2. Update/create the password credentials directly via the REST interface as opposed to relying on the method in online examples.

I do wish there was an easy way to debug custom endpoints because the current errors that are returned from Splunk are utterly useless.
http://imgur.com/a/basRS

index=_internal sourcetype=splunkd
also contains nothing useful

01-19-2017 10:32:42.492 +1000 ERROR AdminManagerExternal - <class 'splunk.admin.UsageException'>: Received no serialized data via stdin (mode: setup).  Will not continue.
0 Karma