Splunk Search

What causes timechart to start drawing with recent data but change time periods, lopping off recent results?

jschlachet_splu
Splunk Employee
Splunk Employee

I'm looking for unique local/foreign pairs in netstat output to track the number of tcp connections in TIME_WAIT on a server. Here's my query:

index=esos host=web5 sourcetype=netstat earliest=-4d latest=now
| multikv
| eval pair = LocalAddress + "-" + ForeignAddress
| search State=TIME_WAIT LocalAddress!="::ffff:*" | dedup pair | timechart span=5m dc(pair)

When I click search and watch the chart draw, in the beginning it shows the latest data. I'm investigating a recent phenomenon and want to visually compare it to the past several days. While the graph accumulates more data, the time period of the chart eventually changes, lopping off much of the recent data. What causes this, and how can I still get a timechart of this data with relatively high resolution?

1 Solution

hexx
Splunk Employee
Splunk Employee

What is happening here is that by forcing a time span of 5 minutes for the timechart command, you are generating more data points per series than the JSchart library supports:

Searches that return too many results per series can cause JSChart to hang the browser. Splunk employs a throttling strategy that restricts the number of results returned per series to 500 by default.

Let's say that in your case, you are running that search over the past 4 days. The timechart command with "span=5m" will generate up to 1,152 results, given that there can be that many 5-minute time slices in a 4-day period. This exceeds the per-series of JSchart by 652 data points.

What I would recommend is to use the "bins=200" directive instead of forcing a span for your time slices. By giving a target number of data points, timechart will always return a number of results manageable by JSchart, regardless of the time range picked.

index=esos host=web5 sourcetype=netstat earliest=-4d latest=now 
| multikv 
| eval pair = LocalAddress + "-" + ForeignAddress 
| search State=TIME_WAIT LocalAddress!="::ffff:*"
| dedup pair
| timechart bins=200 dc(pair)

View solution in original post

hexx
Splunk Employee
Splunk Employee

What is happening here is that by forcing a time span of 5 minutes for the timechart command, you are generating more data points per series than the JSchart library supports:

Searches that return too many results per series can cause JSChart to hang the browser. Splunk employs a throttling strategy that restricts the number of results returned per series to 500 by default.

Let's say that in your case, you are running that search over the past 4 days. The timechart command with "span=5m" will generate up to 1,152 results, given that there can be that many 5-minute time slices in a 4-day period. This exceeds the per-series of JSchart by 652 data points.

What I would recommend is to use the "bins=200" directive instead of forcing a span for your time slices. By giving a target number of data points, timechart will always return a number of results manageable by JSchart, regardless of the time range picked.

index=esos host=web5 sourcetype=netstat earliest=-4d latest=now 
| multikv 
| eval pair = LocalAddress + "-" + ForeignAddress 
| search State=TIME_WAIT LocalAddress!="::ffff:*"
| dedup pair
| timechart bins=200 dc(pair)
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...