Splunk Search

Is it possible to reuse a field regex in multiple alerts?

tescowill
New Member

We have a large number of alerts which extract data from nginx logs and ping under certain conditions. In each of these alerts we do an identical field regular expression extraction to break the log down into variables, e.g.:

rex field=_raw "\s(?<http_code>\d\d\d)\s(?<response_time>\d+(\.\d*)?|\.\d+)\s"

Is there a way to save and reuse this field extraction so I can use it in a number of alerts, or do I need to duplicate it in each one?

0 Karma

jpolvino
Builder

How about making it a macro? Make it global or scoped to an app, and then call it with:

`macroname`
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...