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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...