Splunk Search

Timechart Graph extends into the future

tprzelom
Path Finder

index=summary_security earliest=-1d@d latest=now orig_sourcetype=dhcp | timechart count by orig_sourcetype | eval marker = "today" | eval _time = _time+1800 | append [search index=summary_security earliest=-7d@d latest=-6d@d orig_sourcetype=dhcp | timechart count by orig_sourcetype | eval marker = "last week" | eval _time = _time+86400*7+1800] | timechart sum(dhcp) by marker

I'm using the above search in order to create a week over week comparison of my sourcetype counts. The problem is that my "last week" data flatlines after the day i'm looking at and continues for a week into the future creating a bunch of white space in my graph.

Any ideas how to solve this one?

Tags (2)
0 Karma
1 Solution

tprzelom
Path Finder

index=summary_security earliest=@d latest=-30m orig_sourcetype=dhcp | timechart partial=f span=30m count by orig_sourcetype | eval marker = "today" | eval _time = _time+1800 | append [search index=summary_security earliest=-7d@d-30m latest=-6d@d-30m orig_sourcetype=dhcp | timechart partial=f span=30m count by orig_sourcetype | eval marker = "last_week" | eval _time = _time+86400*7+1800] | search NOT dhcp=0 | timechart partial=f span=30m avg(dhcp) by marker

This is the final search I came up with. Adding in "search NOT dhcp=0" removed the extra portions of the graph.

View solution in original post

0 Karma

tprzelom
Path Finder

index=summary_security earliest=@d latest=-30m orig_sourcetype=dhcp | timechart partial=f span=30m count by orig_sourcetype | eval marker = "today" | eval _time = _time+1800 | append [search index=summary_security earliest=-7d@d-30m latest=-6d@d-30m orig_sourcetype=dhcp | timechart partial=f span=30m count by orig_sourcetype | eval marker = "last_week" | eval _time = _time+86400*7+1800] | search NOT dhcp=0 | timechart partial=f span=30m avg(dhcp) by marker

This is the final search I came up with. Adding in "search NOT dhcp=0" removed the extra portions of the graph.

0 Karma

dart
Splunk Employee
Splunk Employee

I'd strongly suggest you use the timewrap command for this use case. The documentation should give you some guidance on how to contruct the searches you are after.

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...