Splunk Search

How to match string and apply stats count on a stats count table

rkishoreqa
Communicator

I have a requirement to fetch stats count from raw data logs. Sharing you the query and results.

Query : index="bw6_stg" sourcetype="HYD01"| rex field=_raw "ApplicationName:\s+\[(?P<Applname>.*)];" | stats count by Applname

For the above query below are the results.

Applname       count
abcd                     5
abcd.app            6
efgh                     4
efgh.app            3

Now I want to add 'abcd' count and 'abcd.app' count (5+6), it should show total=11
Same as above 'efgh' count and 'efgh.app' count (4+3); total=7. 

I need to build query for the above total, can anyone guide me on this.

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Do that by normalizing the names before computing the counts.

index="bw6_stg" sourcetype="HYD01"
| rex field=_raw "ApplicationName:\s+\[(?P<Applname>.*)];" 
| eval Applname=mvindex(split(Applname,"."), 0)
| stats count by Applname
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Do that by normalizing the names before computing the counts.

index="bw6_stg" sourcetype="HYD01"
| rex field=_raw "ApplicationName:\s+\[(?P<Applname>.*)];" 
| eval Applname=mvindex(split(Applname,"."), 0)
| stats count by Applname
---
If this reply helps you, Karma would be appreciated.
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 ...