Dashboards & Visualizations

Referencing token value in Panel Title

kiddsupreme
Explorer

First, a quick look at my existing code:

<form>
  <label>Alert Status</label>
  <fieldset submitButton="false" autoRun="true">
    <input type="dropdown" token="errorcode_tok" searchWhenChanged="true">
      <label>KPI Selector</label>
      <default>%BGP-5-ADJCHANGE:</default>
      <choice value="%BGP-5-ADJCHANGE:">%BGP-5-ADJCHANGE:</choice>
      <choice value="%BGP_SESSION-5-ADJCHANGE:">%BGP_SESSION-5-ADJCHANGE:</choice>
      <choice value="%BGP-5-FLAP:">%BGP-5-FLAP:</choice>
      <choice value="%OSPF-5-ADJCHANGE:">%OSPF-5-ADJCHANGE: </choice>
      <choice value="%OSPF-5-ADJCHG:">%OSPF-5-ADJCHG:</choice>
      <choice value="%PM-4-ERR_DISABLE:">%PM-4-ERR_DISABLE:</choice>
      <choice value="%PM-SP-4-ERR_DISABLE:">%PM-SP-4-ERR_DISABLE:</choice>
      <choice value="%SPANTREE-2-ROOTGUARD_BLOCK:">%SPANTREE-2-ROOTGUARD_BLOCK:</choice>
      <choice value="%C4K_IOSMODPORTMAN-4-POWERSUPPLYBAD:">%C4K_IOSMODPORTMAN-4-POWERSUPPLYBAD::</choice>
      <choice value="%C6K_POWER-SP-1-PD_HW_FAULTY:">%C6K_POWER-SP-1-PD_HW_FAULTY:</choice>
    </input>
    <input type="time" token="TimeRangePkr" searchWhenChanged="true">
      <label>Time Range</label>
      <default>
        <earliest>-8h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Total Active BGP Events</title>
      <viz type="horseshoe_meter_app.horseshoe_meter">
        <search>
          <query>[search errorcode=$errorcode_tok$ dv_severity NOT "Clear" state=Processed | fields dv_number ] NOT [search errorcode=$errorcode_tok$ dv_severity="Clear" state=Closed | fields dv_number ]  | dedup dv_number | stats count(eval(dv_node)) as TOTAL</query>
          <earliest>rt</earliest>
          <latest>rt</latest>
          <sampleRatio>1</sampleRatio>
        </search>

Pretty straight forward, right? So why when I do this:

<title>$errorcode_tok$</title>

The title displays $errorcode_tok$ .... literally. Am I missing something on why it doesn't seem to be replacing the reference to the dropdown selection? Thanks in advance.

1 Solution

niketn
Legend

@kiddsupreme, following works fine for me. Are you trying something else?

<form>
  <label>Token in Title</label>
   <fieldset submitButton="false" autoRun="true">
     <input type="dropdown" token="errorcode_tok" searchWhenChanged="true">
       <label>KPI Selector</label>
       <default>%BGP-5-ADJCHANGE:</default>
       <choice value="%BGP-5-ADJCHANGE:">%BGP-5-ADJCHANGE:</choice>
       <choice value="%BGP_SESSION-5-ADJCHANGE:">%BGP_SESSION-5-ADJCHANGE:</choice>
       <choice value="%BGP-5-FLAP:">%BGP-5-FLAP:</choice>
       <choice value="%OSPF-5-ADJCHANGE:">%OSPF-5-ADJCHANGE: </choice>
       <choice value="%OSPF-5-ADJCHG:">%OSPF-5-ADJCHG:</choice>
       <choice value="%PM-4-ERR_DISABLE:">%PM-4-ERR_DISABLE:</choice>
       <choice value="%PM-SP-4-ERR_DISABLE:">%PM-SP-4-ERR_DISABLE:</choice>
       <choice value="%SPANTREE-2-ROOTGUARD_BLOCK:">%SPANTREE-2-ROOTGUARD_BLOCK:</choice>
       <choice value="%C4K_IOSMODPORTMAN-4-POWERSUPPLYBAD:">%C4K_IOSMODPORTMAN-4-POWERSUPPLYBAD::</choice>
       <choice value="%C6K_POWER-SP-1-PD_HW_FAULTY:">%C6K_POWER-SP-1-PD_HW_FAULTY:</choice>
     </input>
     <input type="time" token="TimeRangePkr" searchWhenChanged="true">
       <label>Time Range</label>
       <default>
         <earliest>-8h</earliest>
         <latest>now</latest>
       </default>
     </input>
   </fieldset>
   <row>
    <panel>
      <title>$errorcode_tok$</title>
      <html></html>  
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@kiddsupreme, following works fine for me. Are you trying something else?

<form>
  <label>Token in Title</label>
   <fieldset submitButton="false" autoRun="true">
     <input type="dropdown" token="errorcode_tok" searchWhenChanged="true">
       <label>KPI Selector</label>
       <default>%BGP-5-ADJCHANGE:</default>
       <choice value="%BGP-5-ADJCHANGE:">%BGP-5-ADJCHANGE:</choice>
       <choice value="%BGP_SESSION-5-ADJCHANGE:">%BGP_SESSION-5-ADJCHANGE:</choice>
       <choice value="%BGP-5-FLAP:">%BGP-5-FLAP:</choice>
       <choice value="%OSPF-5-ADJCHANGE:">%OSPF-5-ADJCHANGE: </choice>
       <choice value="%OSPF-5-ADJCHG:">%OSPF-5-ADJCHG:</choice>
       <choice value="%PM-4-ERR_DISABLE:">%PM-4-ERR_DISABLE:</choice>
       <choice value="%PM-SP-4-ERR_DISABLE:">%PM-SP-4-ERR_DISABLE:</choice>
       <choice value="%SPANTREE-2-ROOTGUARD_BLOCK:">%SPANTREE-2-ROOTGUARD_BLOCK:</choice>
       <choice value="%C4K_IOSMODPORTMAN-4-POWERSUPPLYBAD:">%C4K_IOSMODPORTMAN-4-POWERSUPPLYBAD::</choice>
       <choice value="%C6K_POWER-SP-1-PD_HW_FAULTY:">%C6K_POWER-SP-1-PD_HW_FAULTY:</choice>
     </input>
     <input type="time" token="TimeRangePkr" searchWhenChanged="true">
       <label>Time Range</label>
       <default>
         <earliest>-8h</earliest>
         <latest>now</latest>
       </default>
     </input>
   </fieldset>
   <row>
    <panel>
      <title>$errorcode_tok$</title>
      <html></html>  
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

kiddsupreme
Explorer

You have got to be kidding me. So when I was doing the editing, I would switch back and forth between UI and Source. When I would look, it would show the literal variable name. But when I clicked Save, all of the sudden it was showing properly. My apologies folks, I should have taken... one...more...step

Vebloud
Explorer

You have just save me a lot of time trying to figure out what is wrong, simple save. Thanks

0 Karma

seva98
Path Finder

@kiddsupreme Your comment needs to be in bold. Had exactly same problem, saving solved the issue. Thanks!

niketn
Legend

@kiddsupreme, when you are in UI Edit mode, tokens will not be set. Now you know 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

p_gurav
Champion

One question, are you getting right value in search query errorcode=$errorcode_tok$ after selecting for dropdown?

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...