Splunk Search

How to expand the dates between two dates?

Sankar_g30
New Member

I want to display the date between two date range EX. 3/11 -3/19

Field : SDate= 3/11/2018 EDate=3/19/2018

I need the output as 3/11 , 3/12, 3/13.....3/19.

Tags (1)
0 Karma

javiergn
SplunkTrust
SplunkTrust

@Sankar_g30 please do not forget to accept an answer if you are happy with it

0 Karma

mayurr98
Super Champion

hey try this run anywhere search

| makeresults 
| eval SDate="3/11/2018",EDate="3/19/2018" 
| rex field=SDate "(?<sdate>\d+\/\d+)" 
| rex field=EDate "(?<edate>\d+\/\d+)"

In your environment, you should write

<your_base_Search> | rex field=SDate "(?<sdate>\d+\/\d+)" | rex field=EDate "(?<edate>\d+\/\d+)"

let me know if this helps!

0 Karma

javiergn
SplunkTrust
SplunkTrust

Hi,

Use gentimes for that:

| gentimes start=3/11/2018 end=3/19/2018 increment=1d
| eval dates = strftime(starttime, "%m/%d")
| table dates

Output:

alt text

If you want to get rid of the leading zeros I can show you how to do that too.

Regards,
J

0 Karma
Get Updates on the Splunk Community!

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

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...