Knowledge Management

How to change the output of a textbox based on user input and use it in search?


I have two textboxes i) holds the keyword ii) hosts the exact flag

If user adds 0 in exact keyword flag - The the search should show the keyword added in first textbox as *keyword* otherwise it should show simply keyword. I tried Macro but it didn't work. Any ideas?

  <label>Test Dashboard</label>
  <fieldset submitButton="false">
    <input type="text" token="kwsearch">
    <input type="text" token="exact">
          <query>|makeresults | fields - _time | eval Result = `make_keyword($kwsearch$, $exact$)`</query>
        <option name="count">10</option>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>

My Macro is:
defined as:


Tags (2)
0 Karma


Hello @nabeel652,

I just testet your dashboard. I believe the root of your troubles are missing quotation marks.

This will NOT work:

| makeresults | eval Result=test

This will also NOT work:

| makeresults | eval Result="\""+test+"\""

I got it working by putting quotation marks around $kwsearch$ without using a macro:

<query>|makeresults | fields - _time | eval Result=if($exact$==0,"\"$kwsearch$\"","$kwsearch$")</query>
0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!