Splunk Search

Why is timechart not working to show DNS count and upper/ lower bounds on the same graph?

POR160893
Builder

Hi,

 

I am trying to show the number of DNS logs per hour here on a graph with the upper and lower bound lines showing on the same plot.

This is my current query:

| tstats count where index=dns groupby _time span=1h
| eval time=strftime(_time,"%Y-%m-%d %H:%M:%S")

| stats avg(count) as lambda
| eval alpha=0.01
| eval lower=lambda/(2*n)
| eval upper=lambda/(2*(1-alpha))

| timechart span=1h sum(count) as count, avg(lower) as lower, avg(upper) as upper

Currently, nothing is outputted:

POR160893_0-1680096454070.png

 



Can you please help?


Thanks

Labels (3)
0 Karma

somesoni2
Revered Legend

The stats command will summarize  and reduce the result to just the 'lambda' field, so your subsequent timechart will not work.  You want to keep the output of previous command along with your lambda calculations, so use eventstats instead. (https://docs.splunk.com/Documentation/Splunk/9.0.4/SearchReference/Eventstats)

Try something like this

 

| tstats count where index=dns groupby _time span=1h
| eval time=strftime(_time,"%Y-%m-%d %H:%M:%S")
| eventstats avg(count) as lambda
| eval alpha=0.01
| eval lower=lambda/(2*n)
| eval upper=lambda/(2*(1-alpha))

 

 

0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...