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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...