Splunk Search

How extract field and value using rex?

karthi2809
Builder

29-Mar-2023 04:56:35:PM: |CPU Utilization % Average ------- 11

 

Expected result:

11

Labels (1)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<expected>\d+)$"
0 Karma

karthi2809
Builder

@ITWhisperer 

rex field=_raw "MemoryUsage %(?<MemoryUtilization>[^']+)"

MY result is

------------ 41.4

 

expected result

41.4

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If you move the goal posts by providing different examples, you can expect the solution to break. Try something like this (based on the two examples given so far!)

| rex "(?<expected>[\d\.]+)$"
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...