<?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 Re: Passing tokens dynamically to search query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258576#M176408</link>
    <description>&lt;P&gt;Open your search in the search dashboard, you should have something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" Category=$categories$|...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" Category=Category=$categories$| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or something else, in other words: what you have after Category=?.&lt;/P&gt;

&lt;P&gt;Every way make another try, if some values of category are strings with spaces:&lt;BR /&gt;
index="myindex" Category="$categories$"| ...&lt;BR /&gt;
put double quotes around token.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2016 09:14:24 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2016-10-18T09:14:24Z</dc:date>
    <item>
      <title>Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258573#M176405</link>
      <description>&lt;P&gt;I have a drop down which I populate with the query and editing field values&lt;BR /&gt;
index="myindex"|stats values(Category) as categories|rex field=categories mode=sed "s/Change Request/CR/" |rex field=categories mode=sed "s/Central Functions/CF/"| mvexpand categories|eval label= categories |eval value = categories&lt;/P&gt;

&lt;P&gt;Now since I had changed drop down values how will i pass the original field value as token to my search query where it will work&lt;BR /&gt;
index="myindex" &lt;STRONG&gt;Category=$categories$&lt;/STRONG&gt;| chart count over sourcetype by "Priority" | addtotals fieldname=Total| foreach * [eval Req_Percent = count *100 / Total] | fields - Total&lt;/P&gt;

&lt;P&gt;This is not working.. I want to pass the category i select from drop down and change it to field value and pass to query.. How can i accomplish that.. Please help&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 07:32:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258573#M176405</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2016-10-18T07:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258574#M176406</link>
      <description>&lt;P&gt;if you open the search dashboard from your panel, what you find instead of $categories$?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 07:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258574#M176406</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-10-18T07:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258575#M176407</link>
      <description>&lt;P&gt;I get no results found.. When i give query with full field values, its displaying correctly&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 08:40:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258575#M176407</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2016-10-18T08:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258576#M176408</link>
      <description>&lt;P&gt;Open your search in the search dashboard, you should have something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" Category=$categories$|...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" Category=Category=$categories$| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or something else, in other words: what you have after Category=?.&lt;/P&gt;

&lt;P&gt;Every way make another try, if some values of category are strings with spaces:&lt;BR /&gt;
index="myindex" Category="$categories$"| ...&lt;BR /&gt;
put double quotes around token.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 09:14:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258576#M176408</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-10-18T09:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258577#M176409</link>
      <description>&lt;P&gt;I added double quotes. Reason its not displaying is.. I have used rex in dropdown query and modified the values in drop down (reduced field values length).. when i pass those values to search,  they are not there in my log and not getting displayed. Problem here is I'm not able to add rex as calculated field   in props file.. Any idea on how to add this as calculated field? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 11:09:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258577#M176409</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2016-10-18T11:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258578#M176410</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" | rex field=categories mode=sed "s/Change Request/CR/" | rex field=categories mode=sed "s/Central Functions/CF/"| mvexpand categories |  search Category="$categories$" | chart count over sourcetype by "Priority" | addtotals fieldname=Total| foreach * [eval Req_Percent = count *100 / Total] | fields - Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2016 11:18:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258578#M176410</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-18T11:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Passing tokens dynamically to search query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258579#M176411</link>
      <description>&lt;P&gt;Harini,&lt;BR /&gt;
did you find a solution to this issue?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 06:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-tokens-dynamically-to-search-query/m-p/258579#M176411</guid>
      <dc:creator>nagarjuna560</dc:creator>
      <dc:date>2019-11-25T06:40:53Z</dc:date>
    </item>
  </channel>
</rss>

