Splunk Search

field extraction

chuck_life09
Path Finder

Hi ,

I need help in the below, 

There is a description column, which has like

Description

process_1_details : name : msmg cpu:43% memory:4% disk:67%
process_2_details : name : hefe cpu:0% memory:8% disk:56%

I want a search query to extract these name , cpu, memory, disk fields and want this kind of output.

name                 cpu               memory               disk

msmg              msmg43%   msmg4%          msmg67%

hefe                 hefe0%          hefe8%             hefe56%

want the process name to be attached with all the related details.

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @chuck_life09,

you have to extract fields and combine to have the wantes output, something like this:

your_search
| rex "^\w+\s+:\s+name\s+:\s+(?<name>[^ ]+)\s+cpu:(?<cpu>[^ ]+)\s+memory:(?<memory>[^ ]+)\s+disk:(?<disk>.*)"
| eval cpu=name.cpu, memory=name.memory, disk=name.disk
| table name cpu memory disk

you can test the regex at https://regex101.com/r/wGGNn6/1

Ciao.

Giuseppe

Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...