Getting Data In

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

phoenixdigital
Builder

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)

crash1011
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

phoenixdigital
Builder

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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Think Like an Architect: Introducing the Splunk Certified Cybersecurity Defense ...

In cybersecurity, defenders respond to threats. Architects design the systems that stop them.    As ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...