Splunk Search

how to count commas in a filed and display as table

sivaram520
New Member

I am new to splunk , can some one please help me on below case

my log looks like this
Name="ABCD"
Config Name="XYZ"
dates="2017-01-01,2017-01-02,2017-01-03,2017-01-05,2017-01-07"
missing_dates="2017-01-04,2017-01-06"
Msg="SUCCESS" or "FAIL"

I need to count number of missing dates and display in table table format with below headers only for SUCCESS Msg

Name Config count_of_missing_dates Msg

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Assuming you already have the fields extracted, try this.

... | eval count_of_missing_dates = mvcount(split(missing_dates, ",")) | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Assuming you already have the fields extracted, try this.

... | eval count_of_missing_dates = mvcount(split(missing_dates, ",")) | ...
---
If this reply helps you, Karma would be appreciated.

DalJeanis
Legend

Or, to be more verbose...

your base search 
| where Msg="SUCCESS" 
| eval count_of_missing_dates = mvcount(split(missing_dates, ",")) 
| table Name Config count_of_missing_dates Msg
0 Karma

sivaram520
New Member

Thank you very much 🙂 it's worked

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...