Dashboards & Visualizations

How to add an offset of one month to a date token?

Kavey
Path Finder

Hi,

I have a form where the user can choose a date which is actually a month of a specific year (MM-YYYY) used as a token for the time modifier "earliest". Then I would like to add an offset of one month to the chosen date for "latest".

I know I could do something like:

mysearch earliest="epochtime_date" | eval latest=earliest+2592000 | ...

However, I would like to have the best performance possible by minimizing as much as I can the time range of my search so I need to have a search more like:

mysearch earliest="epochtime_date" latest="earliest_one_month_offset" | ...

I've been doing research, but I couldn't find anything. Do you think it would possible?

Thank you!

0 Karma
1 Solution

ktugwell_splunk
Splunk Employee
Splunk Employee

Tried using relative_time?

| eval time=relative_time(now(), "+1mon")

http://docs.splunk.com/Documentation/Splunk/6.4.0/SearchReference/CommonEvalFunctions

That should meet your requirement.

View solution in original post

ktugwell_splunk
Splunk Employee
Splunk Employee

Tried using relative_time?

| eval time=relative_time(now(), "+1mon")

http://docs.splunk.com/Documentation/Splunk/6.4.0/SearchReference/CommonEvalFunctions

That should meet your requirement.

Kavey
Path Finder

Thank you not exactly what I want but it is working perfectly.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...