Splunk Search

how to get Stats sum of field with latest correlationId?

karthi2809
Builder

Hi All,

Below query to get stats sum of field values of latest correlationId. need to show in pie chart. But i am getting values as other.PFA screenshot

 

 index="mulesoft" *Upcoming Executions* content.scheduleDetails.lastRunTime="*"
[search index="mulesoft"  *Upcoming Executions*   environment=DEV | stats latest(correlationId) as correlationId | table correlationId|format]|rename content.scheduleDetails.lastRunTime as LastRunTimeCount | stats count(eval(LastRunTimeCount!="NA")) as LastRunTime_Count  count(eval(LastRunTimeCount=="NA")) as NA_Count by correlationId| stats   sum(LastRunTime_Count) as LastRunTime_Count,sum(NA_Count) as NA_Count

 

 

Labels (2)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Your last stats command outputs two columns LastRunTime_Count and NA_Count.  Pie chart can only use one column.  Can you illustrate your intentions with column output and describe how a pie chart can depict both?

0 Karma

karthi2809
Builder

Hi @yuanliu 

Thanks, how can we club the both into one to show count based on the two conditions

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Thanks, how can we club the both into one to show count based on the two conditions


What do you mean "based on the two conditions?"  Your original question simply says 

to show in pie chart. But i am getting values as other

The answer to this is: You cannot have a pie chart with two columns.  If you "getting values as other" is not the problem, what is?  Illustrate your data - in text (anonymize as needed), illustrate desired result - normally I'd say in text but in this case, a mockup graphic piechart could work, then, explain the logic to derive the desired results from illustrated data in plain language without SPL.  These are three essential ingredients of an answerable question.

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...