Splunk Search

How to merge search results into a meaningful data?

2chs
Explorer

Hi There,

Need to combine these two searches meaningfully, can someone help please.

 

1st Query:

index=xyz ....

| chart count(serviceName) as total count(eval(isPolicySuccessful="true")) as successTotal by serviceName

 

which gives something like below;

serviceName      total     successTotal
srvc1                   26429       26344
srvc2                       80               80
srvc3                        12              12

 

2nd Query:

index=xyz ....

| bin _time span=1s
| stats count AS TPS by _time serviceName | eventstats max(TPS) as peakTPS by _time serviceName | eval peakTime=if(peakTPS==TPS,_time,null())
| chart max(TPS) AS "PeakTPS" eval(round(avg(TPS),2)) AS "AVG TPS" min(TPS) AS "MinTPS" first(peakTime) as peakTime by serviceName | fieldformat peakTime=strftime(peakTime,"%x %X")

which gives something like below:

serviceName     PeakTPS       AVG TPS      MinTPS        peakTime
srvc33                11                         1.64                 1             10/15/20 16:34:40
srvc1                     1                          1.00                 1             10/15/20 16:44:42
srvc5                    2                           1.63                 1             10/15/20 20:35:22

 

Now the problem is how to merge these two results into a meaningful one?

something like below:

serviceName      total     successTotal   PeakTPS       AVG TPS      MinTPS        peakTime
srvc1                   26429       26344                  1                          1.00                 1             10/15/20 16:44:42

 

Please help!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @2chs,

I cannot test the search but see the approach, something like this:

index=xyz ....
| eventstats count(serviceName) as total by serviceName
| eventstats count(eval(isPolicySuccessful="true")) as successTotal by serviceName
| eventstats max(TPS) as peakTPS by _time serviceName 
| eval peakTime=if(peakTPS==TPS,_time,null())
| chart values(total) AS total values(successTotal) AS successTotal max(TPS) AS "PeakTPS" eval(round(avg(TPS),2)) AS "AVG TPS" min(TPS) AS "MinTPS" first(peakTime) as peakTime by serviceName 
| fieldformat peakTime=strftime(peakTime,"%x %X")

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...