Splunk Search

Why is the date 2017-01-01 marked as calenderweek 2017-52 when using eval strftime?

HeinzWaescher
Motivator

Hi,

I'm calculating the calenderweek with this:

| eval calenderweek=strftime(_time,"%Y-%V")

For some reason for 2017-01-01, the calenderweek is 2017-52, any ideas why?

Date -> Calenderweek
2017-01-03 -> 2017-01
2017-01-02 -> 2017-01
2017-01-01 -> 2017-52
2016-12-31 -> 2016-52
2017-12-30 -> 2016-52

Thanks in advance,
Heinz

0 Karma
1 Solution

HeinzWaescher
Motivator

Think I got it myself...
I'm calculating year & week separately. Better approach would be

| eval week=relative_time(_time,"@w1")
| eval week=strftime(week,"%Y-%m-%d")

View solution in original post

HeinzWaescher
Motivator

Think I got it myself...
I'm calculating year & week separately. Better approach would be

| eval week=relative_time(_time,"@w1")
| eval week=strftime(week,"%Y-%m-%d")

Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...