Splunk Dev

how to extract only one filed from events out of possible duplicates

VI371887
Path Finder

Hi I have event logs where

rex under field extraction, to extract each value following a string and stopping at first coma, and avoid duplicates

example :
hcyycuvubuv : 45544.466, "disk_byte" :23.45667, "disk_byte_quota": 23.345t,

in above string, I am only looking for numbers that come after "disk_byte" :
, which is 23.45667

problem is, in my events the disk_bytes string is not at the same location in logs and there's disk_bytes_quota which should be ignored.

example :

first event
chhchvhvh: 223. 455, "disk_byte" :23.45667,"disk_byte_quota": 23.345t,
gghffvhh:3455

second event
chhchvhvh: 223. 455, tuvjvujjvg:3456.566, "cpu_percentage":23.45677,gghffvhh:3455.788,"disk_byte" :23.45667, "disk_byte_quota": 23.345t,

Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The regex string "disk_byte"\s:(?[\d.]+)" will extract the "disk_byte" field and ignore the "disk_bytes_quota" field.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The regex string "disk_byte"\s:(?[\d.]+)" will extract the "disk_byte" field and ignore the "disk_bytes_quota" field.

---
If this reply helps you, Karma would be appreciated.

VI371887
Path Finder

hi i am having similar issues,

with msg field

it's has different values can be numbers, strings, path, punctuations, blank space like shown below.

"msg" :"35556"
"msg" :"<<÷] {<} ;;"
"msg" :"ycuvuuu jvbigg buivuv"
"msg" :" "

now problem is, i have written rex as
\msg\":(? \". *\") \,

but it returns value which following msg field.

"msg" :"vjvuv igivc uvviv", "origin" :"abcgc", "time" :23.45677",

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...