Splunk Search

multi pattern string calculation on fields and count the fields value too

sumitnagal
Path Finder

I have log coming in this format. this value is dynamic and keep changing in terms of Form and numbers
Counts=[100A=10,100B=1,100C=2,100D=1,100E=3,100A=20,100B=1,100C=2,100D=1,100E=3]

I want to calculate
100A=30
100B=2
100C=4
100D=2
100E=6

I have ask similar question where I have different requirements
http://answers.splunk.com/answers/185780/multi-pattern-string-calculation-on-fields.html

Tags (4)
0 Karma

bmacias84
Champion

I think you want to use extract(kv). This should give you fields for any dynamic range of files in the counts field

...| rex "Counts=\[(?<Counts>[^\]]+)\]" | field _time Counts|extract pairdelim=","  kvdelim="=" | fields _time 100* | stats count(*) as * by _time
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...

Operationalizing TDIR: Building a More Resilient, Scalable SOC

Optimizing SOC workflows with a unified, risk-based approach to Threat Detection, Investigation, and Response ...

Introducing .conf Stories Series!

“.conf Stories” Series – First Feature: Rich Mahlerwein   Every year .conf brings together some of the most ...