All Apps and Add-ons

How to ignore some rex data?

albyva
Communicator

Using the extract tool, I'm trying to build a field on the "has reached XXXX" number from a Cisco log using the following rex example: | rex "(?i) has reached (?P[^,]+)"

%ROUTING-BGP-5-MAXPFX : No. of IPv4 Unicast prefixes received from 1.2.3.4 has reached 10622, max 14000

It works great, except it's pulling in data I don't want from a similar set of data listed below:

%ENV_MON-2-FAN: Fan array has reached CRITICAL level.

How do I ignore the "CRITICAL level" and only report the number of prefixes? Overall I want something like (NOT "Fan array has reached"), but that obviously doesn't work in rex.

Thanks,

0 Karma
1 Solution

lukejadamec
Super Champion

Try this:
| rex "(?i) has reached (?P<fieldname>\W[^,]+)"
This assumes that you're only interested in numbers - \W means not a letter.

View solution in original post

lukejadamec
Super Champion

Try this:
| rex "(?i) has reached (?P<fieldname>\W[^,]+)"
This assumes that you're only interested in numbers - \W means not a letter.

albyva
Communicator

The \d did it. Thanks.

| rex "(?i) has reached (?P<FIELDNAME>\d[^,]+)"

somesoni2
Revered Legend

I guess it should be "\d" to capture just the digits. "\W" didn't work for me.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...