<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using form input to search for multiple token variations in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-form-input-to-search-for-multiple-token-variations/m-p/359080#M23373</link>
    <description>&lt;P&gt;I have a basic dropdown in a form where we are searching for a user name in First Name Last Name format.  I want to be able to take that token and use it in searches with multiple variations.  An example is :  index=foo search user="First Name Last Name" OR  user="First Name.LastName".&lt;/P&gt;

&lt;P&gt;Any help appreciated!&lt;/P&gt;</description>
    <pubDate>Fri, 29 Dec 2017 14:10:53 GMT</pubDate>
    <dc:creator>stevegadd</dc:creator>
    <dc:date>2017-12-29T14:10:53Z</dc:date>
    <item>
      <title>Using form input to search for multiple token variations</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-form-input-to-search-for-multiple-token-variations/m-p/359080#M23373</link>
      <description>&lt;P&gt;I have a basic dropdown in a form where we are searching for a user name in First Name Last Name format.  I want to be able to take that token and use it in searches with multiple variations.  An example is :  index=foo search user="First Name Last Name" OR  user="First Name.LastName".&lt;/P&gt;

&lt;P&gt;Any help appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 14:10:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-form-input-to-search-for-multiple-token-variations/m-p/359080#M23373</guid>
      <dc:creator>stevegadd</dc:creator>
      <dc:date>2017-12-29T14:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using form input to search for multiple token variations</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-form-input-to-search-for-multiple-token-variations/m-p/359081#M23374</link>
      <description>&lt;P&gt;if you know dropdown format, you can achieve this in search like: (Let's say there is a space between)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=foo.. | eval mval=$token$| rex field=mval "^(?&amp;lt;firstname&amp;gt;\w+)\s(?&amp;lt;lastname&amp;gt;\w+)$"
    | search (user=mval OR user=firstname.".".lastname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Having 'user=' in first pipe next to index would be more optimized. However, it would require some tweaking in Dashboard XML or Macro.&lt;/P&gt;

&lt;P&gt;Macro:&lt;BR /&gt;
you need to create a macro that takes only one parameter (your token), and returns a string like:&lt;BR /&gt;
(user="fname lname" OR user=fname.lname)&lt;BR /&gt;
Ex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| makeresults | eval mval=$param$
| rex field=mval "^(?&amp;lt;fname&amp;gt;\w+)\s(?&amp;lt;lname&amp;gt;\w+)$" 
| eval search = "(user=".fname," ".lname." OR user=".fname.".".lname.")" 
| return $search]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can call it in your search as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo 'mymacro($token$)'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;XML:&lt;BR /&gt;
I couldn't think of a way now using 'change' or 'set' tags. however, I am sure there are ways. I am sure somesoni will explain this part &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 15:43:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-form-input-to-search-for-multiple-token-variations/m-p/359081#M23374</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2017-12-29T15:43:57Z</dc:date>
    </item>
  </channel>
</rss>

