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!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...