Splunk Search

Change x axis _time display to weekly instead of daily

link22
Explorer

So I'm aiming for a month's worth of data to be displayed as "Week 1, Week 2, Week 3, Week 4" instead of by "Apr 13, Apr 30, etc."

I've been formatting both my XML and search string but to no avail. Any suggestions?

0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

You could either use the calendar week %V

your search | eval week=strftime(_time,"%V") |stats count by week

Or

your search|eval week=strftime(relative_time(_time,"@w1"),"%Y-%m-%d")|stats count by week

or if you want to specifically display week number then,

your search|eval week=strftime(relative_time(_time,"@w1"),"%Y-%m-%d")|stats count by week|streamstats count as weeknum|eval week="Week".weeknum|fields - weeknum
Happy Splunking!

View solution in original post

renjith_nair
SplunkTrust
SplunkTrust

You could either use the calendar week %V

your search | eval week=strftime(_time,"%V") |stats count by week

Or

your search|eval week=strftime(relative_time(_time,"@w1"),"%Y-%m-%d")|stats count by week

or if you want to specifically display week number then,

your search|eval week=strftime(relative_time(_time,"@w1"),"%Y-%m-%d")|stats count by week|streamstats count as weeknum|eval week="Week".weeknum|fields - weeknum
Happy Splunking!

renjith_nair
SplunkTrust
SplunkTrust

@link22, does it work for you?

Happy Splunking!
0 Karma

link22
Explorer

It did! Thank you so much, you really helped me a lot!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

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 ...