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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...