Splunk Search

How to use token value in stats group by field in Splunk dashboard

kasimanikandan
Engager

Hi Team,

I have stats group by fields as token it will change dynamically based on time selection. for example if select since 1st Jun 24 then my query will be like below.

eventtype="abc" |stats count by a,b,c 

and if select date before 1st Jun 2024 i.e 30th May 2024 i would like to have stats group by field like below.

eventtype="abc" |stats count by a,d,e

So my current implementation is putting group by field in token, token will be set based on time selection and final query would be like below.

eventtype="abc" |stats count by $groupby_field$

Now the issue is splunk dashboard says waiting for input the moment i add token input to stats groupby field.

Appreciate your suggestion/help to handle this scenario.

 

Thanks,

Mani

 

Labels (1)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you are changing the groupby_field token in the change handler of the time selection input, which is essentially the input that is being waited for, you could also initialise the groupby_field token in an init block in SimpleXML - it is perhaps a little more complicated to do in Studio

0 Karma

kasimanikandan
Engager

@ITWhisperer didnt worked 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

That sort of response is unlikely to elicit further help from anyone.

Please describe what you have done, and if possible post snippets of your token management logic in your dashboard

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...