Splunk Search

How do I optimize the performance of this search with appendcols?

vranjith009
New Member

Hi ,

Can any one help with fine tuning this search? It's taking a long time to load.

index=me sourcetype=access_apache | stats avg(responsemili) as "Avg Response" |eval "Avg Response"=round('Avg Response',2) | appendcols maxtime=600 [ search index=me sourcetype=access_apache NOT clientip = 172.* NOT clientip = 10.* | stats avg(responsemili) as "Avg Response(Internet)" | eval "Avg Response(Internet)"=round('Avg Response(Internet)',2)] | appendcols maxtime=600 [ search index=me sourcetype=access_apache clientip = 172.* OR clientip = 10.* | stats avg(responsemili) as "Avg Response(Intranet)"|eval "Avg Response(Intranet)"=round('Avg Response(Intranet)',2)]
0 Karma

sundareshr
Legend

See if this works

 index=me sourcetype=access_apache | eval inter=if((clientip!=172. AND clientip != 10.), responsemili, "")  | eval intra=if((clientip=172. AND clientip = 10.),responsemili, "") | stats avg(responsemili) as "Avg Response" avg(inter) as "Avg Response(Internet)",  avg(intra) as "Avg Response(Intranet)"
0 Karma

renjith_nair
Legend

I would use stats with eval instead of appendcols, something like below. You will have to adjust the conditions and syntax inside if or use match but the skeleton should be something similar

index=me sourcetype=access_apache 
|stats avg(eval(if(clientip != 172. AND clientip != 10.),responsemili)) as Avg Response(Internet)",
avg(eval(if(clientip = 172. OR clientip = 10.),responsemili)) as Avg Response(Intranet)",
avg(responsemili) as "Avg Response"

Reference : http://docs.splunk.com/Documentation/Splunk/6.1/Search/Usestatswithevalexpressionsandfunctions

---
What goes around comes around. If it helps, hit it with Karma 🙂

renjith_nair
Legend

let me know if it helps

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

vranjith009
New Member

Its not renjith.

I hope "stats avg(eval(if(clientip != 172. AND clientip != 10.),responsemili))" NOT function is not taking with eval

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...