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!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

February 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...