Splunk Search

Where to store a variable value

RVDowning
Contributor

I want to search for all records where some field value is greater than X where X is some number. A number of searches reference this same value of X. Where can I store that value of X so that I don't have to change all searches that are referencing it when I need to change X to some different value? Namely, I don't want to have to hard code that value.

Tags (1)
0 Karma

pradeepkumarg
Influencer

You can create a macro here Manager » Advanced search » Search macros

Name of the macro - x

Definition of the macro - the value of x (Eg: 5)

In your search

sourcetype=some_sourcetype  fieldname > `x`

0 Karma

pradeepkumarg
Influencer

Sure. You can mark it as answered if that solved your problem 🙂

0 Karma

RVDowning
Contributor

Ah, thank you much!

0 Karma
Get Updates on the Splunk Community!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...