Dashboards & Visualizations

How do you search with value and changed value?

patsta_g
Engager

I have a form with a text field (strfield1), values like '98.12.123456.12345678'.

I need to search with the value of this field (strfield1) and a second value of this field without points ('980012345612345678')

Where/How in the XML can i create a string like:
strfield1b = replace($strfield1$,".","")
so I can search like
index=x AND (Identcode=$strfield1$ OR Identcode=$strfield1b$

0 Karma
1 Solution

renjith_nair
Legend

@patsta_g ,

Try

    <input type="text" token="strfield1">
      <label>Identcode</label>
      <change>
        <eval token="strfield1b">replace($value$,"\\.","")</eval>
      </change>
    </input>
Happy Splunking!

View solution in original post

renjith_nair
Legend

@patsta_g ,

Try

    <input type="text" token="strfield1">
      <label>Identcode</label>
      <change>
        <eval token="strfield1b">replace($value$,"\\.","")</eval>
      </change>
    </input>
Happy Splunking!

patsta_g
Engager

I added "\" - and the everything is fine! 🙂
thanks a lot!

0 Karma

p_gurav
Champion

Hi patsta_g,

You can use token, Please check below code I tested with some sample values:

<form>
  <label>test_text_filter</label>
  <fieldset submitButton="true" autoRun="false">
    <input type="text" token="field1" searchWhenChanged="true">
      <label>Text</label>
      <change>
        <eval token="abc">replace($field1$,"-","")</eval>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults | eval host="ip-1-2-3-4,test-interview,testinterview" | makemv delim="," host| mvexpand host | search host=$field1$ OR host="$abc$"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...