Splunk Search

Custom Search

Ash1
Communicator

query:

|tstats count where index=new_index host=new-host source=https://itcsr.welcome.com/logs* by PREFIX(status:) _time
|rename status:  as Total_Status
|where isnotnull(Total_Status)
|eval SuccessCount=if(Total_Status="0", count, Success), FailedCount=if(Total_Status!="0", count, Failed)

OUTPUT:

Total_Status_timecountFailedCountSuccessCount
02022-01-12 13:30100 100
02022-01-12 13:00200 200
02022-01-13 11:30110 110
5002022-01-13 11:0022 
5002022-01-11 10:3044 
5002022-01-11 10:0088 

 

But i want the output as shown below table:

_timeSuccessCountFailedCount
2022-01-131102
2022-01-123000
2022-01-11012
Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| bin _time span=1d
| stats sum(SuccessCount) as SuccessCount sum(FailedCount) as FailedCount by _time

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| bin _time span=1d
| stats sum(SuccessCount) as SuccessCount sum(FailedCount) as FailedCount by _time

Ash1
Communicator

Hi @ITWhisperer ,

Thank you it worked, but when there are no counts it's showing as empty values in table.

I used fillnull value=0, but it's not working.

How to do this???

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| timechart span=1d sum(SuccessCount) as SuccessCount sum(FailedCount) as FailedCount

Ash1
Communicator

Thank you @ITWhisperer 

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...