Splunk Search

Search Optimization

HeinzWaescher
Motivator

Hi,

I've got ~15.000 events where FieldA exists (in total there are 20.000.000 events). I want to filter out these events and I'm wondering about the performance of different approaches.

Why is

sourcetype=X AND FieldA=*

so slow compared to this

sourcetype=X AND FieldA

BR

Heinz

0 Karma
1 Solution

lukejadamec
Super Champion

In short, the first search takes much longer because it is searching for a lot more stuff eventhough the results are the same. Splunk reads the searches as follows:

sourtype AND X AND FieldA AND *

sourtype AND X AND FieldA

As for the thousands of events from an index of millions, I have found that creating a summary index of the _time and _raw data of the events I want to keep makes life a lot easier. Depending on your situation, you may find accelerated searches work better than summary searches.

View solution in original post

lukejadamec
Super Champion

In short, the first search takes much longer because it is searching for a lot more stuff eventhough the results are the same. Splunk reads the searches as follows:

sourtype AND X AND FieldA AND *

sourtype AND X AND FieldA

As for the thousands of events from an index of millions, I have found that creating a summary index of the _time and _raw data of the events I want to keep makes life a lot easier. Depending on your situation, you may find accelerated searches work better than summary searches.

HeinzWaescher
Motivator

Thanks a lot, now i've got it

0 Karma

Ayn
Legend

The first search doesn't even look for "FieldA", so the first "translated" search there should read:

sourcetype AND X AND *

Meaning Splunk won't look for the field name until after it's found all the values, to see if it can couple the searched value to a field called "FieldA". This is a very good thing to remember when constructing searches as obviously the more you can narrow them down the better.

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...