<?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: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411165#M7143</link>
    <description>&lt;P&gt;Hi, the problem is that the lookup is a bit more complex (see above), and if I come from the other direction (index -&amp;gt; smartguard -&amp;gt; models -&amp;gt; parameters), I need the last lookup to use parameter, Group and version - and Group and Version is "not available"... is there a way to first create a table and then a timechart? I pasted the full code for combox and time series, hope you can see it...&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jan 2019 09:57:48 GMT</pubDate>
    <dc:creator>flopit</dc:creator>
    <dc:date>2019-01-18T09:57:48Z</dc:date>
    <item>
      <title>Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411160#M7138</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the following challenge: the user should be able to dynamically select parameters (a001, a002, a003, …, aXYZ) from a combox (works good, writing to token $parameters_a$), and then the average values of the selected parameters should be displayed in a timeseries (also works good).&lt;/P&gt;

&lt;P&gt;Combox is defined as: &lt;BR /&gt;
token: "parameters_a"&lt;BR /&gt;
token value prefix: "avg("&lt;BR /&gt;
token value suffix: ")"&lt;/P&gt;

&lt;P&gt;Timeseries is defined as: &lt;BR /&gt;
… (lots of code) …| timechart span=$span$ $parameters_a$&lt;/P&gt;

&lt;P&gt;Now, instead of displaying the names avg(a001), avg(a008), avg(a010), ... (dynamically selected!) in the timechart's legend, I want to display the human-readable names of the selected parameters  (these can be retireved by a lookup table: parameter -&amp;gt; parameterText).&lt;/P&gt;

&lt;P&gt;I have a problem how to adjust the timeseries statement to DYNAMICALLY display the parameterText in the legend instead of the avg(aXYZ). If they were static, I could simply rename them using "AS", but in the parameter list, there are up to 50 selectable parameters.&lt;BR /&gt;
How can this be achieved in a simple and dynamic way by adding sth to the timeseries chart statement?&lt;BR /&gt;
It sounds like an easy problem ("display lookup texts instead of the technical names in the time series legend"), but I did not come up with an elegant solution…&lt;/P&gt;

&lt;P&gt;Thanks for helping!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 09:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411160#M7138</guid>
      <dc:creator>flopit</dc:creator>
      <dc:date>2019-01-17T09:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411161#M7139</link>
      <description>&lt;P&gt;@flopit,&lt;/P&gt;

&lt;P&gt;If you just want to replace avg(value1) as value, easiest way is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (lots of code) …| timechart span=$span$ $parameters_a$|rename "avg(*)" as *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need specific text for each parameter, then try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (lots of code) …| timechart span=$span$ $parameters_a$
|untable _time,parameter,avg
|lookup  your_look_up_file parameter output parameterText
|xyseries _time,parameterText,avg
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jan 2019 15:16:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411161#M7139</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-17T15:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411162#M7140</link>
      <description>&lt;P&gt;@flopit can you share complete code for &lt;CODE&gt;parameters_a&lt;/CODE&gt; dropdown for us to assist you better?&lt;/P&gt;

&lt;P&gt;If not could you please explain the following:&lt;BR /&gt;
1. Is your dropdown formed from by Static values or Dynamic? &lt;BR /&gt;
2. Field for value seems to be &lt;CODE&gt;parameter&lt;/CODE&gt;. Is it coming from lookup? &lt;BR /&gt;
3. The same lookup file has &lt;CODE&gt;parameterText&lt;/CODE&gt;? &lt;BR /&gt;
4. What is the lookup file name?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 15:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411162#M7140</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-17T15:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411163#M7141</link>
      <description>&lt;P&gt;@flopit following is a sample run anywhere code with Static Dropdown options (where you can plug in Dynamic Search).&lt;/P&gt;

&lt;P&gt;It prepares the query so that average can be performed on parameter id field and renamed as parameter text.&lt;BR /&gt;
The changes required in your existing dropdown code would be to remove Prefix and Suffix and add &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handler to capture Dropdown label which is the Parameter Text.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;change&amp;gt;
        &amp;lt;set token="parameterText"&amp;gt;$label$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out following run anywhere example and confirm. If your expected behavior is different please provide more details for the code of your existing dropdown as requested.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Dropdown change event handler&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="parameters_a" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;choice value="test01"&amp;gt;First Test&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="test02"&amp;gt;Second Test&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;set token="parameterText"&amp;gt;$label$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        yourCurrentSearch
        | timechart span=$span$ avg("$parameters_a$") as "$parameterText$"
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jan 2019 16:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411163#M7141</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-17T16:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411164#M7142</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;thanks for helping, I will paste the code below bc. there are still two challenges:&lt;BR /&gt;
1. Instead of the dynamic paramText, the token seems to contain the static text "$p_txt$". Think there is sth wrong with assigning the text value of the label, p_txt (this concatenates the param code with the actual param text) , to it in the change statement.&lt;BR /&gt;
3. The input combobox must be multiselect, bc. the user must be able to select multiple parameters and display them with their corresponding labels in the time series.&lt;/P&gt;

&lt;P&gt;Code for Input Combobox:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;input type="multiselect" token="parameters_a"&amp;gt;
      &amp;lt;label&amp;gt;Parameters Analog&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;p_txt&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;param&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;| inputlookup parameters
| search version="$version$"
| search [
  | inputlookup smartguard  | search mac_nwpn = "$mac_nwpn$"
  | lookup models WP_Typ
  | table Group ]
| search (param = "a*" OR param = "i*")
| sort param
| eval p_txt = param + " " + paramText
| table p_txt, param&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;set token="parameterText"&amp;gt;$p_txt$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Code for the time series:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;row&amp;gt;
        &amp;lt;panel&amp;gt;
          &amp;lt;title&amp;gt;Parameter Analog&amp;lt;/title&amp;gt;
          &amp;lt;chart&amp;gt;
            &amp;lt;search&amp;gt;
              &amp;lt;query&amp;gt;index=iot_prod_mtg 
    | search mac_nwpn="$mac_nwpn$"
    | lookup smartguard mac_nwpn
    | eval a008 = case(Hochdrucksensor=="((((A008 * 10) - 200) * 450) / 800) / 10", ((((a008 * 10) - 200) * 450) / 800) / 10, Hochdrucksensor=="((((A008 * 10) - 200) * 345) / 800) / 10", ((((a008 * 10) - 200) * 345) / 800) / 10, 1==1, a008)
    | eval a101 = case(Niederdrucksensor=="((((A101 * 10) - 200) * 345) / 800) / 10", ((((a101 * 10) - 200) * 345) / 800) / 10, Niederdrucksensor=="((((A101 * 10) - 200) * 173) / 800) / 10", ((((a101 * 10) - 200) * 173) / 800) / 10, 1==1, a101)
| timechart span=$span$ avg("$parameters_a$") as "$parameterText$"
              &amp;lt;earliest&amp;gt;$time01.earliest$&amp;lt;/earliest&amp;gt;
              &amp;lt;latest&amp;gt;$time01.latest$&amp;lt;/latest&amp;gt;
              &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
            &amp;lt;/search&amp;gt;
            &amp;lt;option name="charting.chart"&amp;gt;line&amp;lt;/option&amp;gt;
            &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
            &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
          &amp;lt;/chart&amp;gt;
        &amp;lt;/panel&amp;gt;
      &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411164#M7142</guid>
      <dc:creator>flopit</dc:creator>
      <dc:date>2020-09-29T22:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411165#M7143</link>
      <description>&lt;P&gt;Hi, the problem is that the lookup is a bit more complex (see above), and if I come from the other direction (index -&amp;gt; smartguard -&amp;gt; models -&amp;gt; parameters), I need the last lookup to use parameter, Group and version - and Group and Version is "not available"... is there a way to first create a table and then a timechart? I pasted the full code for combox and time series, hope you can see it...&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 09:57:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411165#M7143</guid>
      <dc:creator>flopit</dc:creator>
      <dc:date>2019-01-18T09:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411166#M7144</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
1. it is dynamic values&lt;BR /&gt;
2. the actual values are taken from the events, the end-user can filter the displayed ones by using the lookup (both codings see below)&lt;BR /&gt;
3. yes&lt;BR /&gt;
4. lookup file name is "parameters"&lt;/P&gt;

&lt;P&gt;Already added the full codings for both lookup and time series, please see below "answer"! &lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 09:54:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411166#M7144</guid>
      <dc:creator>flopit</dc:creator>
      <dc:date>2019-01-22T09:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411167#M7145</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;in case sb needs sth similar: I found a solution by combining the suggestions above and first creating a table, and adding extra code for the lookup and special renaming logic (bc the names themselves can contain open and closing brackets. Combox multi-selection only uses delimeter=, . &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=iot_prod_mtg 
| search mac_nwpn="$mac_nwpn$"
| lookup smartguard mac_nwpn
| eval a008 = case(Hochdrucksensor=="((((A008 * 10) - 200) * 450) / 800) / 10", ((((a008 * 10) - 200) * 450) / 800) / 10, Hochdrucksensor=="((((A008 * 10) - 200) * 345) / 800) / 10", ((((a008 * 10) - 200) * 345) / 800) / 10, 1==1, a008)
| eval a101 = case(Niederdrucksensor=="((((A101 * 10) - 200) * 345) / 800) / 10", ((((a101 * 10) - 200) * 345) / 800) / 10, Niederdrucksensor=="((((A101 * 10) - 200) * 173) / 800) / 10", ((((a101 * 10) - 200) * 173) / 800) / 10, 1==1, a101) | table _time, $parameters_a$ | untable _time, param, myvalue | join param [ inputlookup parameters where version="$version$" Group="$group$" | table param, paramText ] | xyseries _time,paramText,myvalue |  timechart span=$span$ avg(*) | rename "avg(*)" as * | rename "avg(*))" as *)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jan 2019 11:53:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411167#M7145</guid>
      <dc:creator>flopit</dc:creator>
      <dc:date>2019-01-22T11:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries: Rename Legend DYNAMICALLY based on Lookup and Token</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411168#M7146</link>
      <description>&lt;P&gt;@flopit, If your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 13:48:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Timeseries-Rename-Legend-DYNAMICALLY-based-on-Lookup-and-Token/m-p/411168#M7146</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-01-22T13:48:15Z</dc:date>
    </item>
  </channel>
</rss>

