Splunk Search

Extracting multiple values from a Field

nabeel652
Builder

I have a field in Windows Backup Events named VolumesInfo
Sample:

<VolumeInfoItem Name="System" OriginalAccessPath="" State="14" HResult="0" DetailedHResult="0" PreviousState="9" IsCritical="1" IsIncremental="0" BlockLevel="1" HasFiles="0" HasSystemState="1" IsCompacted="0" IsPruned="0" IsRecreateVhd="0" FullBackupReason="0" DataTransferred="54001664" NumUnreadableBytes="0" TotalSize="54001664" TotalNoOfFiles="0" Flags="554" BackupTypeDetermined="1" SSBTotalNoOfFiles="0" SSBTotalSizeOnDisk="0" /><VolumeInfoItem Name="C:" OriginalAccessPath="C:" State="14" HResult="0" DetailedHResult="0" PreviousState="9" IsCritical="1" IsIncremental="0" BlockLevel="1" HasFiles="0" HasSystemState="1" IsCompacted="0" IsPruned="0" IsRecreateVhd="0" FullBackupReason="0" DataTransferred="35564748800" NumUnreadableBytes="0" TotalSize="35564748800" TotalNoOfFiles="0" Flags="1576" BackupTypeDetermined="1" SSBTotalNoOfFiles="0" SSBTotalSizeOnDisk="0" /><VolumeInfoItem Name="D:" OriginalAccessPath="D:" State="14" HResult="0" DetailedHResult="0" PreviousState="9" IsCritical="0" IsIncremental="0" BlockLevel="1" HasFiles="0" HasSystemState="0" IsCompacted="0" IsPruned="0" IsRecreateVhd="0" FullBackupReason="0" DataTransferred="3730767872" NumUnreadableBytes="0" TotalSize="3730767872" TotalNoOfFiles="0" Flags="8" BackupTypeDetermined="1" SSBTotalNoOfFiles="0" SSBTotalSizeOnDisk="0" /></VolumeInfo>

This contains information about all the volumes backedup on a certain Computer. However I am struggling to extract all the multiple Volumes and related information like in the sample data there are three volumes "System", "C:" and "D:".

I have tried field extractions but it only returns the first one. makemv and mvexpand is also not helping. I need results in this format:

Compuer VolumeName  TotalSize   DataTransferred
Server1 System      1212             12
Server1 C:        7575            77
Server1 D:        7676            66
Server2 C:        767               7
    and So on…    
0 Karma

DalJeanis
Legend

Try something like this...

| rex field=VolumeInfo "Name=\"(?<temp1>[^\"]+)"  max_match=0
| rex field=VolumeInfo "TotalSize=\"(?<temp2>[^\"]+)"  max_match=0
| rex field=VolumeInfo "DataTransferred=\"(?<temp3>[^\"]+)"  max_match=0
| eval mydata=mvzip(mvzip(temp1,temp2,"!!!!"),temp3,"!!!!")
| mvexpand mydata
| rex field=mydata "^(?<Name>.*?)!!!!(?<TotalSize>.*?)!!!!(?<DataTransferred>.*?)$"
0 Karma

inventsekar
SplunkTrust
SplunkTrust

the TotalSize 1212, 7575.. and DataTransferred are not there at the sample.
(on the sample - TotalSize="54001664", DataTransferred="54001664")

can you please update clearly how these details you found

0 Karma

nabeel652
Builder

Yes, thats just for explaining. I was bit lazy not copying the actual values 🙂

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Tuning Edge Processor in Hybrid Mode: What Limits Each Data Path

When you run Edge Processor in hybrid mode, alongside a Splunk heavy forwarder on the same host, two questions ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Request for Professional Development: Attending .conf26

Winning Over the Boss: Your Pass to .conf26 conf26 is going to be here before you know it. If don't already ...