ISSUE
I have two-drop down boxes with a 1 –many relationship with tokens “service family” and “feature” as below.
A user chooses a “service_family” & “feature” token used to execute a query as below & the result is dependent on the chosen service_family & feature in query with a “lookup” & “Search” etc
index=_internal sourcetype=BookWork
| lookup lookup fd_$l_service_family_tok$_$l_enter_feature_tok$_map
| search fd_feature=$enter_feature_tok$
Example: a user chooses EDH and STMT, service_family=EDH and enter_feature_tok=STMT
l_service_family_tok is just lowercase=”stmt” for query.
But I need to implement a new user choice called ALL, so I made a service_family=ALL and feature “*”, which produces everything in the query. There's no need to implement the lookup and search in the query as it’s not required.
So when ALL is chosen the query executes
index=_internal sourcetype=BookWork
So the issue is how do I get a condition to execute part of the query => (index=_internal sourcetype=BookWork) when the user chooses ALL and *?
Service_family Feature
EDH STMT
EDH INBOX
EDH STMT
EDH ACCTS
GMM CCA
GMM CIA
GMM RESAVER
HWBT PLA
PWS ALL
New Option =>
ALL *
I thought below would result in a conditional query to execute two queries in the same panel, and when ALL is chosen, execute the second query ( index=_internal sourcetype=BookWork)
I thought to set a token called All as true, two ll in (All) lowercase as below
<condition value="ALL">
<set token="feature_values">*</set>
<!--set token="feature_values">ALL</set-->
<set token="All">true</set>
<unset token="form.enter_feature_tok"></unset>
</condition>
And create 2 search queries for and as below.
<search depends="$All$">
<title>BookWorks ALL and individual choices events</title>
<search>
<query> index=_internal sourcetype=BookWork </query>
<earliest>$master_time_span.earliest$</earliest>
<latest>$master_time_span.latest$</latest>
</search>
<option name="charting.chart">column</option>
<option name="charting.drilldown">none</option>
</chart>
<search rejects="$All$">
<title>BookWorks</title>
<search>
<query>
index=_internal sourcetype=BookWork
| lookup lookup fd_$l_service_family_tok$_$l_enter_feature_tok$_map
| search fd_feature=$enter_feature_tok$
</query>
</search>
I do not know how to get it to work, and I obtained the errors search not allowed etc. I did further reading that says “reject” & “depends” is not an attribute of search trying a chart .
http://docs.splunk.com/Documentation/Splunk/7.2.1/Viz/tokens
and elements to set the token values that these attributes consume.
•
•
•
•
•
•
Hey man,
If I get you right you have one lookup for each service right ?
index=_internal sourcetype=BookWork
| lookup lookup fd_$l_service_family_tok$_$l_enter_feature_tok$_map
| search fd_feature=$enter_feature_tok$
If that's the case go ahead and make a lookup including all features called fd_all_all_map with all your options in it. That way you don't have to complicate things and you can still use your logic with both tokens equal to all.
In case you wish to stick with your current xml and based on https://answers.splunk.com/answers/702614/please-help-search-depends-and-search-rejects-not.html you're missing a the query closing tag:
<search depends="$All$">
<query>
index=_internal sourcetype=BookWork **</query>**
</search>
And Last thing you will also need a default condition to unset you "All" token when it's any choice other than all. It should look something like this for you :
<input type="dropdown" token="field1">
<label>field1</label>
<choice value="1">A</choice>
<choice value="2">B</choice>
<choice value="3">C</choice>
<choice value="All">Test</choice>
<change>
<condition value="All">
<set token="All">true</set>
</condition>
<condition>
<unset token="All"></unset>
</condition>
</change>
</input>
Let me know if that helps.
Cheers,
David
Hi David,
Thanks for input "depends" and "rejects" does not seem an attribute of search so I used
yeah you're right ^^ It's supposed to be applied on etc.. check here : http://docs.splunk.com/Documentation/Splunk/7.2.1/Viz/tokens