Splunk Enterprise

Conditionally apply or ignore prefix in search query

Digvijay
Path Finder

My code :

<search>
<query>| makeresults | eval API="party_interaction_rest" , METHOD="GET",OPERATION="Alle,LIST_PARTY_INTERACTIONS" |
append [| makeresults | eval API="ticket_mgmt_rest" , METHOD="GET",OPERATION="Alle,LIST_TROUBLE_TICKETS"] | eval OPERATION=split(OPERATION,",")
|mvexpand OPERATION| table API METHOD OPERATION | search API="$token_service$" METHOD =$token_method$ </query>
</search>

 

In above code $token_method$ is dropdown field for which prefix is defined  as below:

<input type="dropdown" token="token_method" searchWhenChanged="true">
<label>Select Method:</label>
<fieldForLabel>METHOD</fieldForLabel>
<fieldForValue>METHOD</fieldForValue>
<search>
<query>| makeresults | eval API="party_interaction_rest",METHOD="Alle,GET,POST" |
append [| makeresults | eval API="ticket_mgmt_rest",METHOD="Alle,GET,POST,PATCH"] |
append [| makeresults | eval API="customer_management_rest",METHOD="Alle,GET,PATCH"] |
append [| makeresults | eval API="agreement_management_rest",METHOD="Alle,GET"] |
append [| makeresults | eval API="product_order_rest",METHOD="Alle,GET,POST,PATCH,DELETE"] |
append [| makeresults | eval API="cust_comm_rest",METHOD="Alle,GET"] |
append [| makeresults | eval API="product_inv_rest",METHOD="Alle,GET,POST,PATCH"] | eval METHOD=split(METHOD,",")
|mvexpand METHOD| table API METHOD | search API="$token_service$"</query>
</search>
<change>
<condition value="Alle">
<set token="token_method">*</set>
</condition>
</change>
<default>Alle</default>
<prefix>"properties.httpMethod"=</prefix>
<initialValue>Alle</initialValue>
</input>

So I want to ignore prefix in some case and only need value from dropdown but in some cases I need prefix .Please guide.

Labels (1)
Tags (1)
0 Karma
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 ...