Splunk Search

How to add a query parameter conditionally?

mamerige
Engager

I'd like to conditionally add a parameter to my Splunk query based on the version number of my application.

I have an "uploadType" input that I want to use, but only for events where the app version is over a certain number because the old versions do not contains this field.

Something like:

if appVersion >= 10.0
then include uploadType=$uploadType$,
otherwise don't filter this field.

Is this possible?

0 Karma

somesoni2
Revered Legend

Assuming you want to include the filters base search of your panels, you could do something like this

your base search (appVersion>=10.0 AND uploadType=$uploadType$) OR (appVersion<10.0) | rest of your search
0 Karma
Get Updates on the Splunk Community!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...