Splunk Search

In a table using CSV data, how do we add "waitdays" to date and show in new column ?

ibob0304
Communicator

I have CSV data like below,

---------------------------------------------------
Date1              |   WaitDays   
---------------------------------------------------
9/24/2018      | 20
8/28/2018      | 160
7/13/2018      | 01

How do we add the waitdays to date and show in new column ?

 | eval inputDate = relative_time(Date1, "%Y-%m-%d")
 | eval expiring = inputDate  + WaitDays
 | eval expiring = strftime(expiring, "%Y-%m-%d")

I tried this, but it is not working as expected.

0 Karma
1 Solution

Vijeta
Influencer

Hi,

You can use the below logic for date and waitdays conversion to seconds and then calculating exp date

eval date=strptime(Date1,"%m/%d/%Y")| eval wdays= WaitDays * 60 *24 * 60|eval exp= date + wdays| eval exp=strftime(exp,"%Y/%m/%d")

Thanks
Vijeta

View solution in original post

Vijeta
Influencer

Hi,

You can use the below logic for date and waitdays conversion to seconds and then calculating exp date

eval date=strptime(Date1,"%m/%d/%Y")| eval wdays= WaitDays * 60 *24 * 60|eval exp= date + wdays| eval exp=strftime(exp,"%Y/%m/%d")

Thanks
Vijeta

ibob0304
Communicator

Tried 60*24*60 and it worked.,

0 Karma

Vijeta
Influencer

yes sorry missed the * while typing

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