Splunk Enterprise

help on subsearch with join command

jip31
Motivator

hi

I need to improve the subsearch below

I explain : the piece of code in the subsearch count the number of core of the machine

So this count is always the same no matter the time

So I wonder if it would better to put these results in a csv lookup and to query the csv lookup instead to query on the index?

or is there some other tracks for improve this search?

Thanks

index=toto sourcetype=tutu type=* runq 
| fields host _time runq type 
| stats max(runq) as runq by host _time 
| join host 
    [ search index=toto sourcetype=tutu type=* 
    | fields host cpu_core
    | search host=1328 
    | stats max(cpu_core) as nbcore by host ] 
| eval Vel = (runq / nbcore) 
| eval _time = strftime(_time, "%d-%m-%y %H:%M:%S") 
| sort - _time 
| rename host as Host, _time as Heure 
| table Heure Host Vel 
| sort - Vel

 

 

Tags (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

using lookup instead of query "static" values from index is almost always better/more efficient way.

There are many conf presentation which cover this issue. In most cases you should avoid to use join and instead use stats. Here is some links to those 

r. Ismo

0 Karma

jip31
Motivator

Hi, many thanks

Tags (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...