Dashboards & Visualizations

Can you help me create the SPL for a report based on multiple columns?

azaki
Explorer

hey all,

Currently, i'm working on an SPL in Splunk to create a dashboard based on a specific time fields.

We have a table with 4 date columns of interest, let's say their names like that : X, Y, Z, W... some of the values at each column can be null or in this format YYYY-MM-DD.

For each unique month of each column, we need to aggregate the number of X records, Y records. Z records and W records
For example if we have the following data sample:
alt text

We need to have a report like that ...
At November ==> number of X records: 1 , number of Y records: 1, number of Z records: 0 , number of W records: 0
At December ==> number of X records: 0, number of Y records: 1, number of Z records: 1 , number of W records: 1

0 Karma
1 Solution

somesoni2
Revered Legend

GIve this a try

your current search giving fields X Y Z W
| eval temp=1
| untable temp month column
| eval month=substr(month,1,7)
| chart count over month by column
| where month!="NULL" 

View solution in original post

0 Karma

macadminrohit
Contributor

Below is the search i created taking dummy data as per your requirement :

| makeresults 
| eval Text="X:2018-11-01:NULL:NULL,Y:NULL:2018-11-03:2018-12-02,Z:NULL:2018-12-05:NULL,W:NULL:NULL:2018-12-10" 
| makemv Text delim="," 
| mvexpand Text 
| eval field_Name=mvindex(split(Text,":"),0) 
| rex field=Text "(X|Y|Z|W)\:(?<date>.*)" 
| makemv date delim=":" 
| mvexpand date 
| table _time date field_Name 
| eval Month=strptime(date,"%Y-%m-%d") 
| eval Month=strftime(Month,"%b") | fillnull Month value=0 | chart count(field_Name) as count over Month by field_Name | search Month!=0

Let us know if it works.

somesoni2
Revered Legend

GIve this a try

your current search giving fields X Y Z W
| eval temp=1
| untable temp month column
| eval month=substr(month,1,7)
| chart count over month by column
| where month!="NULL" 
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...