Monitoring Splunk

Splunk optimization : dedup or latest()?

timmalos
Communicator

Hi
For last 2 months i created a lot of dashboards on Splunk.
In most of my searchs i need to get only the last series of results.
I see i use 2 methods, both work well, but i would know which one is more optimized.
Sometimes I use

search|dedup MyField sortby -_time|table MyField aField bField

and sometimes I use

search|stats latest(aField),latest(bField) by MyField

What is the best to use for short periods/long periods?

0 Karma

sowings
Splunk Employee
Splunk Employee

In a distributed environment, stats is likely to be faster, because the indexers can "prestats" before sending their results to the search head. I think that dedup may do a little of this, but the notable distinction is that dedup can't be used with report acceleration searches. I tend to use stats for this purpose.

kristian_kolb
Ultra Champion

I would think that dedup should be slightly faster, but not by a big margin. Best way to find out is to use the Job Inspector for the searches and look for yourself. It's far more important to limit the initial search, i.e. what comes before the first pipe. Specifying correct index, host, sourcetype and time-limits will have far more effect on the search performance.

However, your dedup syntax looks a bit off, shouldn't it be sortby instead of by?

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Dedup
http://docs.splunk.com/Documentation/Splunk/latest/Search/UsingtheSearchJobInspector

/K

timmalos
Communicator

Ure right for dedup, i wrote all from mind so mistakes 🙂

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

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 ...