Splunk Search

Search & timechart: faster and slower when using fields command?

orinciog
New Member

Hello!

I have an index with more than 25 million events (and there are going to be more). There is a saved search that inserts into an auxiliary summary index with some events based on a custom lookup (big index=domains, summary index=infected domains). I tried to make a timechart (with the count of all the events) with an overlay chart where the line represents only the infected ones.

However, for the last 24h (with about 15M events), the timechart commands takes forever. I observed the following behaviour:

This search...

index="myindex"
| fields ip
| timechart span=10m count(_raw)

...is much more faster than when used in a timechart panel (in the search there are batches of 100.000+ events at a time). However,

index="myindex"
| timechart span=10m count(_raw)

...is much faster when creating the timechart and very slow (batches of 10.000 events) when used with search.

  1. Why is that and what's the best method to create a time chart when having a lot of events?
  2. Does is affect other chart types too? If yes, what's the best practice?

Thanks!

0 Karma
1 Solution

FrankVl
Ultra Champion

Not entirely sure what exactly you are saying with which is faster when. But consider these things:

When running as a dashboard, it typically runs in fast mode, so no field extractions. So much faster than when running it as a normal search (which typically uses smart mode). Using the fields command, you limit the extractions performed, making the search in smart mode much faster.

In general, this type of simple counting is best done using tstats:

| tstats count where index=myindex by _time span=10m | timechart span=10m sum(count)

Or combined into one search for both indexes:

| tstats count where index=domain OR index="infected domains" by _time,index span=10m | timechart span=10m sum(count) by index

View solution in original post

0 Karma

skalliger
Motivator

Because timechart is a transforming command. See Splunk's command types
.

What you probably want to use, is sitimechart.

Skalli

0 Karma

FrankVl
Ultra Champion

Not entirely sure what exactly you are saying with which is faster when. But consider these things:

When running as a dashboard, it typically runs in fast mode, so no field extractions. So much faster than when running it as a normal search (which typically uses smart mode). Using the fields command, you limit the extractions performed, making the search in smart mode much faster.

In general, this type of simple counting is best done using tstats:

| tstats count where index=myindex by _time span=10m | timechart span=10m sum(count)

Or combined into one search for both indexes:

| tstats count where index=domain OR index="infected domains" by _time,index span=10m | timechart span=10m sum(count) by index
0 Karma

orinciog
New Member

@FrankVl is there a way to assign custom name to each of the series (instead of the name of the index)?

0 Karma

orinciog
New Member

That's exactly what I needed!
The results in the timechart were instant.
Thanks!

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...