Splunk Search

how to use one token with different evaluation for 2 panels query under different conditions.

wangkevin1029
Communicator

Hi, Splunkers,

I have a dashboard with 2 panels.

there is one input token,  Gucid_token,

what I need is when Gucid_token is any string but not a 1 or 2 digits number, then use it as search string for panle1's query , in this case, this token has nothing to do with panel 2 query.

panel1

<query>sourcetype="omni:ors:voice" $Gucid_token$

Panel2

<query>sourcetype="omni:ors:voice"   keyword1 keyword2  | search skilllength >1 

when Gucid_token is a 1 or 2 digits number, then ignore it in panel1's query,  but for panel2's query, use this 

token to build search like  search skilllength > $Gucid_token$

panel1

<query>sourcetype="omni:ors:voice" 

Panel2

<query>sourcetype="omni:ors:voice"   keyword1 keyword2  | search skilllength > $Gucid_token$

 

thx in advance.

 

Kevin

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

You changed the name of the input form token - try the drilldown like this

<link target="_blank">/abcabc/guciduuidsid_search_applied_rules_with_ors_log_kvp?form.Gucid_token_with2handlers=$click.value2$</link>

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

In the change handler of the input, set up two tokens, one for each panel, based on the evaluation of the input.

0 Karma

wangkevin1029
Communicator

I need a hidden feature from this input field.  that's why I don't want to use 2 inputs for this.

 

Kevin

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You are not understanding what I am saying. In the change handler for the input, you can set multiple tokens. You still have one input and the hidden feature is that more than one token is set up when the input changes.

0 Karma

wangkevin1029
Communicator

Ok, I kinda understand your suggestion.

you meant having this logic developed in input change handler, instead of in each panel's query.

but how to have 2 different handlers with two tokens in one input?

can you show me some sample code here?  I am a junior  splunker....

 

thx.

 

Kevin

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
    <input type="text" token="Gucid_token">
      <label>$Gucid_token$ - Panel 1 token: $panel1_token$ - Panel 2 token: $panel2_token$</label>
      <change>
        <eval token="panel1_token">if(match(value, "^[0-9][0-9]?$"),"", value)</eval>
        <eval token="panel2_token">if(match(value, "^[0-9][0-9]?$"),value, 1)</eval>
      </change>
    </input>
0 Karma

wangkevin1029
Communicator

Besides,  my drilldown click is to open two dashboards, one is itself, the other one different dashboard, 

 

different dashboard got the passed cellvalue.

 

Kevin

0 Karma

wangkevin1029
Communicator

BTW,  I clicked the same cell I always clicked..  so, the value is a valid value for panel query 1.

 

Kevin

0 Karma

wangkevin1029
Communicator

 Hi, ITWhisperer,

since my original token name is Gucid_token, so, I still keep it for  panel 1 query,  in this way I don't have to change any other original code related to Gucid_token.

but then I noticed some drilldown click stop working, which tries to open the same dashboard.

why this   form.Gucid_token=$click.value2$  to pass cell value to open the same dashboard stop working?  

I attached the full open link at the bottom.

<input type="text" token="Gucid_token_with2handlers" searchWhenChanged="true">

      <label>Gucid/UUID/SID</label>

      <change>

        <eval token="Gucid_token">if(match(value, "^[0-9][0-9]?$"),"", value)</eval>

        <eval token="skillexpressionLength">if(match(value, "^[0-9][0-9]?$"),value, 0)</eval>

      </change>

      <default></default>

    </input>

 

  <drilldown>

          <link target="_blank">/abcabc/guciduuidsid_search_applied_rules_with_ors_log_kvp?form.Gucid_token=$click.value2$</link>

        </drilldown>

 

kevin

 
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You changed the name of the input form token - try the drilldown like this

<link target="_blank">/abcabc/guciduuidsid_search_applied_rules_with_ors_log_kvp?form.Gucid_token_with2handlers=$click.value2$</link>

wangkevin1029
Communicator

it works, makes perfect sense....

 

one it global variable, the other two are local variables.

 

thanks again.

 

Kevin

0 Karma

wangkevin1029
Communicator

thank you very much, works amazingly.... 

0 Karma

wangkevin1029
Communicator

thank you very much, I will give a try.

0 Karma
Get Updates on the Splunk Community!

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...