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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...