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!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...