Splunk Search

How to bring 2 different numerical fields under one column name

dtccsundar
Path Finder

I have to bring 2 different numerical fields in one column name .I am fetching the fields from a view .

Example :I have fields like  below ,

field 1 =Compliant_machines(which has count of compliant machines )

field2 =Non_Compliant_machines(which has count of compliant machines )

I have to bring this like below ,

Compliancesum(Count )
Compliant_Machines   123456
Non_Compliant_machines57421

 

I have acheived this using transpose ,but the drill down is not working using this transpose and stats .

I am used this code for drill down ,

 |search Account_Environment="*" Acc_Name="*" Baseline="*" Rule="*" |stats sum(Compliant_Tested) as Compliant sum(Noncompliant_Tested) as "Non Compliant"|transpose|rename column as "Compliance", "row 1" as "count"| search Compliance="Compliant"|table Acc_Name Acc_No Baseline form Rule " etc

The above code didnt work for me .Can someone help me to achieve this in drill down .

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
|search Account_Environment="*" Acc_Name="*" Baseline="*" Rule="*" 
|stats sum(Compliant_Tested) as Compliant sum(Noncompliant_Tested) as Non_Compliant by Acc_Name Acc_No Baseline form Rule
| eval Compliance=mvappend("Compliant_Machines","Non_Compliant_machines")
| mvexpand Compliance
| eval Count=if(Compliance="Compliant_Machines",Compliant,Non_Compliant)
| fields - Compliant, Non_Compliant

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
|search Account_Environment="*" Acc_Name="*" Baseline="*" Rule="*" 
|stats sum(Compliant_Tested) as Compliant sum(Noncompliant_Tested) as Non_Compliant by Acc_Name Acc_No Baseline form Rule
| eval Compliance=mvappend("Compliant_Machines","Non_Compliant_machines")
| mvexpand Compliance
| eval Count=if(Compliance="Compliant_Machines",Compliant,Non_Compliant)
| fields - Compliant, Non_Compliant
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!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...