Splunk Search

multi pattern string calculation on fields

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=0,100B=1,100C=2,100D=1,100E=3]

I want to first calculate how many form I have collected in this example
FormCount=5

I want to calculate Total Form calculated
FormTotal=7

Please let me know

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Append this to your search:

...  | rex "Counts=\[(?<Counts>[^\]]+)\]" | eval Counts = replace(Counts, "\w+=", "") | makemv Counts delim="," | eval FormCount = mvcount(Counts) | streamstats count as eventnum | eventstats sum(Counts) as FormTotal by eventnum
Get Updates on the Splunk Community!

Monitoring Postgres with OpenTelemetry

Behind every business-critical application, you’ll find databases. These behind-the-scenes stores power ...

Mastering Synthetic Browser Testing: Pro Tips to Keep Your Web App Running Smoothly

To start, if you're new to synthetic monitoring, I recommend exploring this synthetic monitoring overview. In ...

Splunk Edge Processor | Popular Use Cases to Get Started with Edge Processor

Splunk Edge Processor offers more efficient, flexible data transformation – helping you reduce noise, control ...