Splunk Search

Need help on a query

mahesh27
Communicator

 

|msats sum(count-error) as Failed where index=metrics_index by service errorNumber errortype

 

Results:

serviceerrorNumbererrortypeFailed
aaca0fail8
aaca10pass1000
aaca25fail290
aaca120fail8
aaca80pass800
aaca200fail400
aaca210pass22
aaca500fail10
aaw120fail8
aaw80pass2000
aaw200fail3
aaw210pass56
aaw500fail22
aaw0pass0
www0fail8
www10pass1000
www25fail290
www120fail8
www80pass800
www200fail400
amb500fail10
amb120fail8
amb80pass2000
amb200fail3
amb210pass56
amb500fail22
amb0pass0
asf0fail8
asf10pass1000
asf0pass0
asf0fail8
asf10pass1000



But we want the output as shown below:
We need only top 4 errornumber show up along with the failed count

serviceerrorNumbererrortypeFailed
aaca0fail2538
10pass
25fail
120fail
80pass
200fail
210pass
500fail
aaw120fail2089
80pass
200fail
210pass
500fail
0pass
www0fail2506
10pass
25fail
120fail
80pass
200fail
amb500fail2099
120fail
80pass
200fail
210pass
500fail
0pass
asf0fail2016
10pass
0pass
0fail
10pass

 

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Either your table is misaligned or you're trying to do something very non-obvious.

I don't understand what is the relation beetween this:

serviceerrorNumbererrortypeFailed
aaca0fail8
aaca10pass1000
aaca25fail290
aaca120fail8
aaca80pass800
aaca200fail400
aaca210pass22
aaca500fail10

And this:

serviceerrorNumbererrortypeFailed
aaca0fail2538
10pass
25fail
120fail
80pass
200fail
210pass
500fail

 

Also remember that Splunk is not Excel so you can't merge cells

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @mahesh27,

You can filter results like below;

| mstats sum(count-error) as Failed where index=metrics_index by service errorNumber errortype | sort 4 - Failed

 

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.
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 ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

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