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
Get Updates on the Splunk Community!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...