Splunk Search

Timechart expression - No results found.

splunk_zen
Builder

I'm having trouble computing an aggregate performance indicator.
The following expression (which has the goal to obtain a value up to 100 to feed a radial gauge ) is working,

index=resources_reporting source="*/output/ora_queries/client07/OS_metrics.csv"
| fields USED_CPU HOST_NAME
| eval Platform = case(
HOST_NAME like "%scp%" AND NOT (HOST_NAME like "%dscp%"), "SCPs", 
HOST_NAME like "%dscp%", "DSCPs",
    ...
HOST_NAME like "%mgr%", "MGRs"
)
| eval OptimumCpu = case(
Platform=="SCPs" AND USED_CPU <= 60, 1,
Platform=="DSCPs" AND USED_CPU <= 60, 1,
    ...
Platform=="MGRs" AND USED_CPU <= 60, 1
)
| eval AcceptableCpu = case(
Platform=="SCPs" AND USED_CPU > 60 AND USED_CPU <= 75, 1,
Platform=="DSCPs" AND USED_CPU > 60 AND USED_CPU <= 75, 1,
    ...
Platform=="MGRs" AND USED_CPU > 60 AND USED_CPU <= 75, 1
)
| stats count(USED_CPU) as TotalEvents sum(OptimumCpu) as TotalOptimumCpu sum(AcceptableCpu) as TotalAcceptableCpu by Platform
| fillnull
| eval ScpCpu=if(Platform="SCPs",(TotalOptimumCpu + TotalAcceptableCpu/2) / TotalEvents,0)
| eval DscpCpu=if(Platform="DSCPs",(TotalOptimumCpu + TotalAcceptableCpu/2) / TotalEvents,0)
    ...
| eval MgrCpu=if(Platform="MGRs",(TotalOptimumCpu + TotalAcceptableCpu/2) / TotalEvents,0)
| eval ApdexScore=round(100*(0.17*ScpCpu + 0.17*DscpCpu + ... + 0.04*MgrCpu),2)
    | stats sum(ApdexScore) as TotalApdexScore

which returns something like 99.96,
however I'm missing why I can't get the correponding aggregate time evolution in a line chart, replacing the last line with,

| timechart (ApdexScore) as TotalApdexScore

which returns

No results found.

What should I change to get a timechart of my ApdexScore expression ?

Tags (3)
0 Karma
1 Solution

Ant1D
Motivator

Hi splunk_zen, looking at your query, it seems that you are not bringing the _time field to the point when you need it. Add the _time field to the end of your | stats pipes.

View solution in original post

Ant1D
Motivator

Hi splunk_zen, looking at your query, it seems that you are not bringing the _time field to the point when you need it. Add the _time field to the end of your | stats pipes.

MuS
Legend

just did that, go ahead and accept it 😉

0 Karma

splunk_zen
Builder

So simple...
Thanks !

I'll accept your comment as an answer if you promote it.

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...