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!

Cultivate Your Career Growth with Fresh Splunk Training

Growth doesn’t just happen—it’s nurtured. Like tending a garden, developing your Splunk skills takes the right ...

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering.  Because we’ve ...

How to Send Splunk Observability Alerts to Webex teams in Minutes

As a Developer Evangelist at Splunk, my team and I are constantly tinkering with technology to explore its ...