In a drilldown, I have 2 possible queries and they look like:
qry1=index=fed:xxx_yyyy sourcetype="aaaaa:bbbbb:cccc" source_domain="$token_source_domain$" AND ( mid="$token_mid$" OR "MID $token_mid$")
qry2=index=fed:xxx_yyyy sourcetype="aaaaa:bbbbb:cccc" source_domain="$token_source_domain$" AND (icid="$token_icid$" OR mid="$token_mid$" OR "MID $token_mid$")
if "$token_icid$==0 execute qry1 else execute qry2
How it can be achieve ?
Chatgtp give this answer but not working
index=fed:xxx_yyyy sourcetype="aaaaa:bbbbb:cccc" source_domain="$token_source_domain$" AND ( (($token_icid$=="0") AND (mid="$token_mid$")) OR (($token_icid$!="0") AND (icid="$token_icid$")) OR mid="$token_mid$" OR "MID $token_mid$" )
If you post your existing XML it would be helpful, but I am assuming you have something like
<drilldown>
<set token="token_icid">$row.icid$</set>
</drilldown>
so there are a number of ways to do what you want, but one way is to make and additional constraint for icid that is either empty or the check, as the rest of the search is the same.
<drilldown>
<set token="token_icid">$row.icid$</set>
<eval token="token_query">if($row.icid$=0, "icid=\"".$row.icid$."\" OR ", "")</eval>
</drilldown>
Then your search can be
index=fed:xxx_yyyy sourcetype="aaaaa:bbbbb:cccc" source_domain="$token_source_domain$" AND ($token_query$ mid="$token_mid$" OR "MID $token_mid$")
so you just add $token_query$ which is either empty or the addition icid constraint.
If you post your existing XML it would be helpful, but I am assuming you have something like
<drilldown>
<set token="token_icid">$row.icid$</set>
</drilldown>
so there are a number of ways to do what you want, but one way is to make and additional constraint for icid that is either empty or the check, as the rest of the search is the same.
<drilldown>
<set token="token_icid">$row.icid$</set>
<eval token="token_query">if($row.icid$=0, "icid=\"".$row.icid$."\" OR ", "")</eval>
</drilldown>
Then your search can be
index=fed:xxx_yyyy sourcetype="aaaaa:bbbbb:cccc" source_domain="$token_source_domain$" AND ($token_query$ mid="$token_mid$" OR "MID $token_mid$")
so you just add $token_query$ which is either empty or the addition icid constraint.
Problem solved.
Many thanks for your help.
Before volunteers can help you achieve something, you need to explain what is it that you are trying to achieve without SPL (or ChatGPT).