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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...