Splunk Search

How to generate a Month-Year Series with 3 months interval ?

promukh
Path Finder

Hello Experts,

I need to generate a series of values in the form of Year-Month to part of the drop down list in the Panel

I was trying the below but it only generates the data for 1 Month 

|makeresults  | eval month = strftime(relative_time(now(), "+3mon@mon"), "%B %Y")  | return $month

Jan 2021

 

Expected Ouput :

Jan 2021

April 2021

JULY 2021

 

 

 

 

Labels (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this

| makeresults 
| eval month = strftime(relative_time(now(),"@mon"), "%B %Y"), month2 = strftime(relative_time(now(),"-1mon@mon"), "%B %Y"), month3 = strftime(relative_time(now(),"-2mon@mon"), "%B %Y") 
| eval month=mvappend(month3,month2,month)
| mvexpand month
| fields + month | fields - _time
---
If this reply helps you, Karma would be appreciated.
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!

Index This | How many sevens are there between 1 and 100?

August 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...