Developing Dashboards, Views, and Apps for Splunk Web

 


Setup screen example

Setup screen example

The following example illustrates a setup screen for an app, MySampleApp.

MySampleApp contains three saved searches and a scripted input. In the setup screen, the user specifies the following configurations:

This setup screen modifies savedsearches.conf and inputs.conf.

Sample setup screen

In this example:

The setup screen uses the following REST endpoints to update the configuration:

https://localhost:8089/servicesNS/nobody/MySampleApp/saved/searches/
https://localhost:8089/servicesNS/nobody/MySampleApp/data/inputs/script/

Configuration files for the example

Here are the default configuration files:

savedsearches.conf

[Web Search]
search = sourcetype=access_combined ( 404 OR 500 OR 503 )
dispatch.earliest_time = -1d
cron_schedule = */5 * * * *
enableSched = 1

[Firewall Data Search]
search = sourcetype=cisco_wsa .exe usage!="Unknown"
dispatch.earliest_time = -1d
cron_schedule = */5 * * * *
enableSched = 0

[Email Data Search]
search = sourcetype=cisco_esa OUTBREAK_*
dispatch.earliest_time = -1d
cron_schedule = */5 * * * *
enableSched = 0

inputs.conf

[script://$SPLUNK_HOME/etc/apps/MySampleApp/bin/myscript.sh]
interval = 60
sourcetype = customsourcetype
source = customsource

setup.xml

Here is the setup.xml file that implements the setup screen. Note the following in the setup.xml file:

setup.xml

<setup>

  <!-- Note that the path to the script uses URI encoding -->	
  <block title="Enable a scripted input"
         endpoint="data/inputs/script"
         entity="%24SPLUNK_HOME%252Fetc%252Fapps%252FMySampleApp%252Fbin%252Fmyscript.sh">
    <text>
      &lt;i&gt;Specify the configuration for a single setting in a stanza.&lt;/i&gt;
    </text>

    <input field="interval">
      <label>Specify the interval for [$name$] </label>
      <type>text</type>
    </input>
	
  </block>

  <block title="Enable the schedule for a search"
         endpoint="saved/searches" entity="Web Search">
    <text>
      &lt;i&gt;Specify the configuration for a single setting in a stanza.&lt;/i&gt;
    </text>

    <!-- The field "is_scheduled" maps to the enableSched setting in savedsearches.conf -->		
    <input field="is_scheduled">
      <label>Enable Schedule for $name$</label>
      <type>bool</type>
    </input>
	
  </block>

<block title="Configure Cron Schedule" 
       endpoint="saved/searches" entity="*" mode="iter">
    <text>
      &lt;i&gt;&lt;b&gt;Iteration mode&lt;/b&gt;:
      specify the cron schedule for each search in the conf file.&lt;/i&gt;</text>
    <input field="cron_schedule">
      <label>$name$</label>
      <type>text</type>
    </input>
  </block>
        
  <!-- an example of bulk change - enable all searches -->
  <block title="Set earliest dispatch time" 
         endpoint="saved/searches" entity="*" mode="bulk">
    <text>
      &lt;i&gt;&lt;b&gt;Bulk mode&lt;/b&gt;: enable the earliest dispatch time for each search in the conf file.&lt;/i&gt;
    </text>
    <input field="dispatch.earliest_time">
      <label>Set earliest dispatch time for all searches</label>
      <type>text</type>
    </input>
  </block>

</setup>

This documentation applies to the following versions of Splunk: 4.3 , 4.3.1 , 4.3.2 View the Article History for its revisions.


You must be logged into splunk.com in order to post comments. Log in now.

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!