Splunk Search

How to get a year over year comparison in a search?

myahes
Explorer

using this articles advice (http://blogs.splunk.com/2012/02/19/compare-two-time-ranges-in-one-report/)

i am trying to compare year over year using the following search

index="stacks" earliest=-2mon@mon latest=-1mon@mon| multikv| eval ReportKey="thisYear"| append [search index="stacks" earliest=-14mon@mon latest=-13mon@mon| multikv| eval ReportKey="lastYear"]| timechart distinct_count(Check_Number) AS Check_Count, sum(Amount) AS "Net_Sales" by ReportKey

this generates the side by side data fine. when I add the eval modifier (eval

index="stacks" earliest=-2mon@mon latest=-1mon@mon| multikv| eval ReportKey="thisYear"| append [search index="stacks" earliest=-14mon@mon latest=-13mon@mon| multikv| eval ReportKey="lastYear" | eval _time=_time+60*60*24*365]| timechart distinct_count(Check_Number) AS Check_Count, sum(Amount) AS "Net_Sales" by ReportKey

The previous years data craps out.

Any idea what i am doing wrong?

Tags (3)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

It might be easier to use this app by David Carasso, Timewrap.

https://apps.splunk.com/app/1645/

0 Karma

myahes
Explorer

thank for responding. have you used it? i have tried using the timewrap y command and it doesnt work for me. only get the current year returned.

0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...