Dashboards & Visualizations

Using chart to sort over multiple eval fields

shubhs9
Engager

Hi, I have this requirement which I am trying to test and retrieve the results for.

Premise:
I have a set of ticketing data which contain details of "Owner Name", "Ticket Resolution Status", "Ticket Raised By".
The values in them are as mentioned in an example:

Owner Name : owner_name1601
Ticket Resolution Status: Resolved/Unresolved
Ticket Raised By: User/Admin

I need to tdisplay the result in following format:

Assigned To Unresolved Resolved System Generated User Generated

owner_name2384 3 20 0 0
owner_name261 3 45 0 0
owner_name1387 2 23 0 0
owner_name1404 2 9 0 0

I have written a code which looks like this:

index=ticket_data
| eval res_desc=if(current_ticket_state="Resolved", "Resolved", "Unresolved")
| chart count by owner_name,res_desc
| appendcols[search index=ticket_data
| eval sys_user=if(system_user="BI Admin", "Admin", "User")
| chart count by owner_name,sys_user]

The issue is that the above code uses a subsearch and the limit to that is 50,000 which wouldn't help me in future.

The other code that i tried writing was this:

index=ticket_data
| eval res_desc=if(current_ticket_state="Resolved", "Resolved", "Unresolved")
| eval sys_user=if(system_user="BI Admin", "Admin", "User")
| chart count as user by owner_name,res_desc, sys_user

This clearly doesn't work.

Using stats doesn't help me get the results in the required format.

Could someone suggest me a workaround for this problem statement?

Thanks

Tags (1)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

If each of the criteria is a limited set, I'd just evaluate each value then add them up.

index=ticket_data 
| eval Resolved=if(current_ticket_state=="Resolved",1,0)
| eval Unresolved=if(current_ticket_state=="Unresolved",1,0)
| eval System_gen=if(system_user=="BI Admin",1,0)
| eval User_gen=if(system_user=="User",1,0)
| stats sum(Unresolved) as Unresolved sum(Resolved) as Resolved sum(System_gen) as "System Generated"
  sum(User_gen) as "User Generated" by owner_name
| rename owner_name as "Assigned To"

View solution in original post

yuanliu
SplunkTrust
SplunkTrust

If each of the criteria is a limited set, I'd just evaluate each value then add them up.

index=ticket_data 
| eval Resolved=if(current_ticket_state=="Resolved",1,0)
| eval Unresolved=if(current_ticket_state=="Unresolved",1,0)
| eval System_gen=if(system_user=="BI Admin",1,0)
| eval User_gen=if(system_user=="User",1,0)
| stats sum(Unresolved) as Unresolved sum(Resolved) as Resolved sum(System_gen) as "System Generated"
  sum(User_gen) as "User Generated" by owner_name
| rename owner_name as "Assigned To"

shubhs9
Engager

Worked perfectly. Thanks for the help.

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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Build resilience for the agentic era: Join us at Splunk Go San Jose

AI is changing how organizations build, operate, and secure digital services. As teams adopt AI agents and ...

Manage Edge Processor pipelines end to end with APIs

This guide uses the Data Management APIs to create an Edge Processor, onboard one instance, deploy a pipeline ...