Splunk Search

how to Union 4 searches with 4 field name

splunkt0n
New Member

Hi,

Good day!

have this search:

| union 
    [| pivot latest(field0) AS field0 SPLITROW field4 AS field4 
    | search field0="Success" 
    | stats count as field3 by field1,field2 
    | addtotals row=f col=t labelfield="field2" label="Grand Total" field3 ] 
    [| pivot latest(field0) AS field0 SPLITROW field4 AS field4 
    | search field0="Failed" 
    | stats count as field3 by field1,field2 
    | addtotals row=f col=t labelfield="field2" label="Grand Total" field3 ] 
    [| pivot latest(field0) AS field0 SPLITROW field4 AS field4 
    | search field0="Warning" 
    | stats count as field3 by field1,field2 
    | addtotals row=f col=t labelfield="field2" label="Grand Total" field3 ]

and I want my result to look like this.
alt text

Hope you can help me and thanks in advance!

Tags (2)
0 Karma

mayurr98
Super Champion

can you try this

| pivot latest(field0) AS field0 SPLITROW field4 AS field4 
| search field0="Success" 
| stats count as field3 by field1,field2 
| addtotals row=f col=t labelfield="field2" label="Grand Total" field3 ] 
| append 
[| pivot latest(field0) AS field0 SPLITROW field4 AS field4 
| search field0="Failed" 
| stats count as field3 by field1,field2 
| addtotals row=f col=t labelfield="field2" label="Grand Total" field3 ] 
| append 
[| pivot latest(field0) AS field0 SPLITROW field4 AS field4 
| search field0="Warning" 
| stats count as field3 by field1,field2 
| addtotals row=f col=t labelfield="field2" label="Grand Total" field3 ]
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...