Dashboards & Visualizations

How to pass 'free' text input from a dropdown into query

vidhya
Observer

Hi,

I am looking for help for the following

My Panel intakes a combination of two inputs 'index' and 'customerID' in the query. It has a dropdown with static 'index' and 'customerID' values.  The requirement is how can i enable search for a customerID value which is outside these static values.

For e.g. when i enter '123456' in the dropdown, it should pass value 'index=*,customerID='123456' in the query(considering '123456' was not in static drop down values).

Appreciate your help on this!

Labels (4)
0 Karma

venkatasri
SplunkTrust
SplunkTrust

Hi @vidhya 

Following panel code $customer_id_tok$ will get updated with selected dropdown value and output would be something like this - index=main customerid="123", index=main customerid="1234" etc..  i have considered static customerid values in drop-down for testing you can populate same using dynamic search. In xml <prefix>, <suffix> elements are the key for this to work..

 <row>
    <panel>
      <input type="dropdown" token="customer_id_tok">
        <label>dropdown menu</label>
        <choice value="123">123</choice>
        <choice value="1234">1234</choice>
        <choice value="12345">12345</choice>
        <prefix>index=main customerid="</prefix>
        <suffix>"</suffix>
      </input>
      <table>
        <title>Panel title</title>
        <search>
         <query> [your query goes here] $customer_id_tok$ </query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>

------------------------------------------------

An upvote would be appreciated if it helps! 

Tags (3)
0 Karma

vidhya
Observer

@venkatasri 

Thankyou so much for your response. Perhaps i was not able to explain my query in a better way.

Let us say in the example that you have shared below, i need to search for customerID='4532' (a value not available in static dropdown). The current implementation would only allow me to chose 123, 1234, 12345(available static values). 
In case the customerID value is not available in static values,  i want to pass customer_id_tok  as index=main customerid='4532'.

Please advise .

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

Take a look here for some options to solve this.

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!

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 ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...