<?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: How can I modify search based on token value? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375823#M24605</link>
    <description>&lt;P&gt;I have entered them manually.&lt;/P&gt;

&lt;P&gt;When I use the &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="dcs_performance_data" WellNumber=H307 TagName=15FQ011* |lookup lookname_name WellNumber output suffix|rex mode=sed field=tagname "s/([^_]+_).*/\1/"|eval tagname=tagname.suffix&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It does return the correct TagName but I'm unsure how to insert these into my eval automatically?&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2018 15:20:16 GMT</pubDate>
    <dc:creator>stevenbutterwor</dc:creator>
    <dc:date>2018-02-15T15:20:16Z</dc:date>
    <item>
      <title>How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375817#M24599</link>
      <description>&lt;P&gt;I am attempting to build a dashboard panel using the below search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dcs_performance_data" WellNumber=$well$ TagName=15FQ011* | stats latest(eval(if(TagName="15FQ011W_15",TagValue,null()))) as Out, latest(eval(if(TagName="15FQ011I_15",TagValue,null()))) as In by WellNumber | eval Level=In-Out | chart values(Level)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see the WellNumber element is populated by a user input (drop down) in the dashboard.  What I would also like to do is modify the TagName in the first eval statement based on the $well$ token.  For example, if a user was to select H307 as the WellNumber, this would modify the final two characters of the TagName to 07 (suffix).&lt;/P&gt;

&lt;P&gt;I already have a lookup which correlates WellNumber to the suffix, so I'm sure this will help somehow?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 11:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375817#M24599</guid>
      <dc:creator>stevenbutterwor</dc:creator>
      <dc:date>2018-02-15T11:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375818#M24600</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dcs_performance_data" WellNumber=$well$ TagName=15FQ011* |lookup lookname_name WellNumber output suffix|rex mode=sed field=tagname "s/([^_]+_).*/\1/"|eval tagname=tagname.suffix
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I understood correctly after join using lookup command you will get tagname, suffix, WellNumber...if so try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval tagname="15FQ011W_15", suffix="07"|rex mode=sed field=tagname "s/([^_]+_).*/\1/"|eval tagname=tagname.suffix
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 13:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375818#M24600</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T13:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375819#M24601</link>
      <description>&lt;P&gt;Thanks for your answer.  That seems to be working but how do I insert the resulting TagName's into my dynamic dashboard panel?  E.g. into my stats eval calculation?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| stats latest(eval(if(TagName="15FQ011W_15",TagValue,null()))) as Out, latest(eval(if(TagName="15FQ011I_15",TagValue,null()))) as In by WellNumber | eval Level=In-Out | chart values(Level)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375819#M24601</guid>
      <dc:creator>stevenbutterwor</dc:creator>
      <dc:date>2018-02-15T14:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375820#M24602</link>
      <description>&lt;P&gt;can you specify in detail what are you expecting ? also  not able to understand dynamic dashboard panel?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375820#M24602</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T14:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375821#M24603</link>
      <description>&lt;P&gt;Thanks for your help so far.....&lt;/P&gt;

&lt;P&gt;If you look at the original search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dcs_performance_data" WellNumber=H315 | stats latest(eval(if(TagName="15FQ011W_15",TagValue,null()))) as Out, latest(eval(if(TagName="15FQ011I_15",TagValue,null()))) as In by WellNumber | eval Level=In-Out | chart values(Level)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can see the WellNumber is H315 and the TagName suffix is 15.  What I want to do is change the TagName suffix automatically when I change the WellNumber value.  The suffix values (TagObject) are related to each other in the lookup I mentioned.&lt;/P&gt;

&lt;P&gt;E.g. if I insert H307 as the WellNumber then the TagName becomes 15FQ011W_7, instead of _15 as shown in the example.&lt;/P&gt;

&lt;P&gt;I hope that makes some sense? &lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375821#M24603</guid>
      <dc:creator>stevenbutterwor</dc:creator>
      <dc:date>2018-02-15T14:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375822#M24604</link>
      <description>&lt;P&gt;from where these TagName value is getting populating in eval expression? ...I can see these are different..like &lt;CODE&gt;15FQ011W_15&lt;/CODE&gt;, &lt;CODE&gt;15FQ011I_15&lt;/CODE&gt;&lt;BR /&gt;
and after using &lt;CODE&gt;rex&lt;/CODE&gt; are you  getting &lt;CODE&gt;15FQ011W_7&lt;/CODE&gt; instead of  &lt;CODE&gt;15FQ011W_15&lt;/CODE&gt; when WellNumber is &lt;CODE&gt;H307&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:04:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375822#M24604</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T15:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375823#M24605</link>
      <description>&lt;P&gt;I have entered them manually.&lt;/P&gt;

&lt;P&gt;When I use the &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="dcs_performance_data" WellNumber=H307 TagName=15FQ011* |lookup lookname_name WellNumber output suffix|rex mode=sed field=tagname "s/([^_]+_).*/\1/"|eval tagname=tagname.suffix&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It does return the correct TagName but I'm unsure how to insert these into my eval automatically?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375823#M24605</guid>
      <dc:creator>stevenbutterwor</dc:creator>
      <dc:date>2018-02-15T15:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify search based on token value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375824#M24606</link>
      <description>&lt;P&gt;if you only change last eval by  &lt;CODE&gt;Tagname&lt;/CODE&gt; instaed of &lt;CODE&gt;tagname&lt;/CODE&gt; then it will be used in stats eval query...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dcs_performance_data" WellNumber=H307 TagName=15FQ011* |lookup lookname_name WellNumber output suffix|rex mode=sed field=tagname "s/([^_]+_).*/\1/"|eval Tagname=tagname.suffix| stats latest(eval(if(TagName="15FQ011W_15",TagValue,null()))) as Out, latest(eval(if(TagName="15FQ011I_07",TagValue,null()))) as In by WellNumber | eval Level=In-Out | chart values(Level)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-search-based-on-token-value/m-p/375824#M24606</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T15:26:09Z</dc:date>
    </item>
  </channel>
</rss>

