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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...