Splunk Search

Comparing last year to this year

JovanMilosevic
Path Finder

Hi,

I have 3 single values displaying YTD, MTD and Today's figures.

What I'd like to do is have another 3 single values that give last year's equivalent figures, i.e.

Jan 1 to Sept 17 2011 inclusive, Sept 1 to Sept 17 2011 inclusive, and Sept 17 2011.

Just can't seem to work out what time modifiers I should use.

Thanks in advance.

Tags (1)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi JovanMilosevic

try the following time setting after your search string:

Jan 1 to Sept 17 2011 inclusive -> earliest=-y@y latest=-y@+d@d

Sept 1 to Sept 17 2011 inclusive -> earliest=-y@mon latest=-y@+d@d

Sept 17 2011 -> earliest=-y@d@d latest=-y@+d@d

cheers,

MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi JovanMilosevic

try the following time setting after your search string:

Jan 1 to Sept 17 2011 inclusive -> earliest=-y@y latest=-y@+d@d

Sept 1 to Sept 17 2011 inclusive -> earliest=-y@mon latest=-y@+d@d

Sept 17 2011 -> earliest=-y@d@d latest=-y@+d@d

cheers,

MuS

MuS
SplunkTrust
SplunkTrust

yes, the last @d snaps to the current day, without it it uses the actual time. you can test it in the manager by clicking the timepicker and use the advanced search language. the docs about the time range are here http://docs.splunk.com/Documentation/Splunk/4.3.4/User/ChangeTheTimeRangeOfYourSearch

0 Karma

JovanMilosevic
Path Finder

Thanks for this. For the Sep 17 search, is it possible to get the search to retrieve records for up to the current time on that day, rather than the whole day ?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...