All Apps and Add-ons

Extract multiple values of same field

sriva6
New Member

Hi,

I have logs as shown below:

03 December 2013 03:00:23
Capacity of vmware farm
@{Name=sdlc_stg_win_01; FreeSpaceGB=615.4912109375; CapacityGB=2800}
@{Name=sdlc_stg_win_02; FreeSpaceGB=272.9287109375; CapacityGB=2800}
03 December 2013 01:00:26
Capacity of vmware farm
@{Name=sdlc_stg_win_01; FreeSpaceGB=613.2490234375; CapacityGB=2800}
@{Name=sdlc_stg_win_02; FreeSpaceGB=322.607421875; CapacityGB=2800}
02 December 2013 23:00:20
Capacity of vmware farm
@{Name=sdlc_stg_win_01; FreeSpaceGB=614.712890625; CapacityGB=2800}
@{Name=sdlc_stg_win_02; FreeSpaceGB=334.740234375; CapacityGB=2800}
02 December 2013 21:00:19
Capacity of vmware farm
@{Name=sdlc_stg_win_01; FreeSpaceGB=614.712890625; CapacityGB=2800}
@{Name=sdlc_stg_win_02; FreeSpaceGB=355.515625; CapacityGB=2800}
02 December 2013 19:00:37
Capacity of vmware farm
@{Name=sdlc_stg_win_01; FreeSpaceGB=619.689453125; CapacityGB=2800}
@{Name=sdlc_stg_win_02; FreeSpaceGB=365.21484375; CapacityGB=2800}
02 December 2013 10:29:37
Capacity of vmware farm
@{Name=sdlc_stg_win_01; FreeSpaceGB=643.68359375; CapacityGB=2800}
@{Name=sdlc_stg_win_02; FreeSpaceGB=463.99609375; CapacityGB=2800}

I want to extract FreeSpaceGB for both my storage volumes sdlc_stg_win_01 and sdlc_stg_win_02. I am able to extract the FreeSpaceGb for the first volume using the field extracter but not the second one. Please help.

0 Karma

linu1988
Champion

why dont you extract Name=sdlc_stg_win_01; FreeSpaceGB=614.712890625 then split them and get the required value. Moreover i think splunk should be extracting them on it's own.

0 Karma

somesoni2
Revered Legend

Try this

|  rex max_match=0 "(?m)Name=(?<DriveName>[^;]+)" 
|  rex max_match=0 "(?m)FreeSpaceGB=(?<FreeSpace>[^;]+)" 
|  rex max_match=0 "(?m)CapacityGB=(?<TotalCapacity>[^}]+)"
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...