Configure a data input

You'll need a source of data to set up a data input. For this walkthrough, we'll configure a data input that requests stock information from Yahoo Finance using a REST API.

Create the REST URL for the data input

In this walkthrough we'll use the following URL-encoded REST query as a data input for our add-on:

https://query.yahooapis.com/v1/public/yql
?q=select%20*%20from%20yahoo.finance.quotes%20
where%20symbol%20in%20(%22YHOO%22)&format=json
&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=

We got this REST URL by using the public YQL Console on the Yahoo! Developer Network website. The following query retrieves stock information for the YHOO stock symbol from the yahoo.finance.quotes table:

select * from yahoo.finance.quotes where symbol in ("YHOO")

The console displays a REST version of the query, which is what we'll use as our data input.

Configure the data input

On the add-on home page, click Configure Data Collection page:

This page is empty because there aren't any data inputs configured yet.

  • Click Add Data to configure a data input.

The Create Data Input wizards opens. Now we can create our data input:

  1. On the Choose Input Method page, click Modular input using a REST API.
    This option creates a modular input for you, based on a REST URL that you provide. You won't need to write the underlying Python code.
  2. On the Create Data input page, specify the properties of the data input:
    • Sourcetype name: enter "yahoofinance".
      For each data input you configure, the Add-on Builder creates a source type for it, using the name you provide.
    • Input name: enter "StockInfo" for the name of the data input.
    • Input display name: Enter "Stock Info" for the data input title.
      This title appears in Splunk Web under Settings > Data inputs.
    • Description: Enter "Data input for stock info" for the data input description.
      This description appears in Splunk Web under Settings > Data inputs.
    • Collection interval: Leave the default value of value "30", which means the add-on will request data every 30 seconds.

  3. Click Next.
  4. On the Define the data input page, define the input details:
    • REST URL: Enter "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback= ", which is the query we created earlier.
    • REST method: Select GET, which indicates the type of HTTP request to make.
    • REST request headers: Leave these fields blank.

  5. To verify the input is working, click Test.
    The Output pane displays the result of the request so you know it's working:
  6. Click Save, and then click Finish.
  7. To verify the data input was created, click Configure Data Collection on the app's navigation bar. The new data input now appears on the Configure Data Collection page:

>>  Continue to Pass a variable to the data input.