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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...