Dashboards & Visualizations

Form and inputlookup

DTERM
Contributor

What is the problem with the following form? The form utilizes inputlookup to generate a dropdown. The dropdown list works. However the query portion is not working out. Where is this problem? Thanks in advance.

    <form class="formsearch">
<label>Top H</label>
<!--
<searchTemplate>index=myapp supportGroup="$VGroup$" | top 15 tgtHostname</searchTemplate> 
<searchTemplate>index=myapp supportGroup="$VGroup$"</searchTemplate>
<searchTemplate>index=myapp supportGroup="$VGroup$" | top 15 "$VGroup$"</searchTemplate>
<searchTemplate>index=myapp supportGroup=$VGroup$ | top 15 $VGroup$</searchTemplate>
<searchTemplate>index=myapp supportGroup=$VGroup$ | top 15 supportGroup</searchTemplate>
-->

<searchTemplate>index= myapp supportGroup=$VGroup$</searchTemplate>

<fieldset>
   <input type="dropdown" token="supportGroup">
   <label>Select Support Group</label>
   <choice value="*">All</choice>
   <populatingSearch fieldForValue="VGroup" fieldForLabel="VGroup"><![CDATA[|inputlookup supportgroup.csv | fields + VGroup]]></popula
tingSearch>
  </input>

    <input type="time">
        <default>Last 7 days</default>
    </input>
</fieldset>

  <row>
    <chart>
      <title>Top Hosts</title>
      <option name="charting.chart">pie</option>
      <option name="drilldown">all</option>
    </chart>
    <chart>
      <title>Top Hosts</title>
      <option name="drilldown">all</option>
    </chart>
  </row>
  <row>
    <table>
      <title>Top Hosts</title>
      <option name="drilldown">all</option>
    </table>
  </row>


</form>
Tags (1)
0 Karma
1 Solution

lguinn2
Legend

I think it should be

<searchtemplate>index= myapp supportGroup="$supportGroup$"</searchtemplate>

I put quotes around variables as a best practice. They aren't required.

View solution in original post

0 Karma

lguinn2
Legend

I think it should be

<searchtemplate>index= myapp supportGroup="$supportGroup$"</searchtemplate>

I put quotes around variables as a best practice. They aren't required.

0 Karma

rroberts
Splunk Employee
Splunk Employee

Couple of things:

1. Element and Attributes are case sensitive should be fieldForValue and fieldForLabel and check the elements searchTemplate and populatingSearch.

2. Your token is VGroup in your searchTemplate. Should match your token attribute value in your input element ie token="VGroup"

3. fieldForValue and fieldForLabel should be "supportGroup"

0 Karma

DTERM
Contributor

Thanks. It finally worked.

0 Karma

DTERM
Contributor

Your suggestion works.

This is the condensed script. Any idea why this does not work? The drop down works, however the query is blank.

index=MyApp supportGroup=$VGroup$

All |inputlookup supportgroup.csv | fields + VGroup Last 7 days
0 Karma

lguinn2
Legend

What do you get if you type

index=myapp supportGroup=XXX

in the search box, where XXX is the name of a valid support group?

0 Karma

DTERM
Contributor

The search comes up empty. It did not work. Any other ideas?

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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Catalog Is Now Generally Available on Splunk Cloud Platform

A Unified View of Your Data  Security logs, application events, business data, and historical telemetry often ...

Your Path to AgenticOps: AI Experiences for Every Splunk Practitioner

Your Path to AgenticOps: AI Experiences for Every Splunk Practitioner   Watch on demand us for a demo-driven ...