Getting Data In

Apply timeformat to earliest/latest attributes

frank_zhang
Path Finder

Hi,

We embed splunk in our product and need to generate searches with earliest/latest attributes based on timestamp user picks, and our server and splunk indexer might be running in different timezones. We can either generate a timestamp based on indexer's timezone and put no timezone in it, such as:

sourcetype=foo index=bar earliest=10/18/2012:13:00:00 |...

Or generate timestamp based on other timezone or UTC and put timezone info in it, such as:

sourcetype=foo index=bar timeformat%m/%d/%Y:%H:%M:%S:%z earliest=10/18/2012:17:00:00:+0000 |...

Is there any negative impact such as performance overhead with the second option due to adding "timeformat%m/%d/%Y:%H:%M:%S:%z" into the search?

Thanks in advance.

Tags (1)
1 Solution

_d_
Splunk Employee
Splunk Employee

Splunk will convert earliest and latest timestamps in epoch format internally. Therefore, since you can generate timestamps in UTC, your best bet would be to have earliest and latest in epoch as well.

Ex: index=bar sourcetype=foo earliest=1350538170 latest=1350538870 | more search commands

Hope this helps,

d.

View solution in original post

0 Karma

frank_zhang
Path Finder

With our GUI we allow users to specify both absolute and relative time range, we generate values like -24h for the latter case.

0 Karma

_d_
Splunk Employee
Splunk Employee

Splunk will convert earliest and latest timestamps in epoch format internally. Therefore, since you can generate timestamps in UTC, your best bet would be to have earliest and latest in epoch as well.

Ex: index=bar sourcetype=foo earliest=1350538170 latest=1350538870 | more search commands

Hope this helps,

d.

0 Karma

frank_zhang
Path Finder

That's the first option we considered, however it makes debugging a bit harder since you have to convert from epoch time in order to figure out that the time range specified here, doesn't it?

kristian_kolb
Ultra Champion

I guess you've ruled out the possibility to use relative time modifiers, e.g. -24h, @d, etc etc?

/k

0 Karma
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...