The timestamp date in kibana is one day less than the date field shown in ES


(Bhavana) #1

Hello Everyone,

I am fetching the date field in ES as timestamp field in kibana. If the date is "2017-01-17" in ES, the same data in kibana the timestamp range is "2017-01-16 00:00:00.00" to "2017-01-16 20:00:00.000"

Could you please explain , why there is a difference of one day ?

Could we change the default setting of time stamp shown "last 15 minutes" ?

Thanks


(CJ Cenizal) #2

That's very strange. How is this field being mapped? This sounds like it might be related to https://github.com/elastic/kibana/issues/10575. Could you take a look at that issue and tell me if it describes your problem?

Alternatively, this could be some kind of weird timezone issue.

In answer to your second question, you can configure the default timepicker range in Management > Advanced Settings:

CJ


(Bhavana) #3

Thank you for the reply.

Yes, the problem is exactly the issue mentioned in the post.

But , as the solution mentioned in the issue to map
"date1" : { "type" : "date","format":"strict_date"}
i tried this and indexed the data but kibana is showing {date-1} again :frowning:

In kibana the date field is timestamp with above mapping , when i select any visualization graph with x-axis as date histogram and interval as "daily" . In X-axis the date is repeating more than once. The graph screen shot is attached below.

Could you please mention why the date is occurring more than once though the date interval is daily?

Thank you


(CJ Cenizal) #4

This is just a side effect of the way we render axes. We render tick marks at regular intervals and then attempt to label them wherever there's space. Because your time range is so short (1 or 2 days), there are multiple tick marks which fall within a single day. So when the label is rendered for those tick marks, is just shows the current day they fall in, which happen to be the same day.

I agree it's kind of confusing, but it's not a bug with your data. If you'd like to see this fixed, would you mind filing an issue on our repo?

Thanks,
CJ


(Bhavana) #5

Thank you for mentioning that , the visualization looks good. As it is not a bug, i don't want to file an issue.

Could you also see this,

As i mentioned in this post , kibana date is {date-1} which is exactly the below issue you mentioned.

But as they mentioned to try the strict_date mapping, i tried the below mapping before indexing:

"date" : {
"type" : "date",
"format":"yyyy-mm-dd"
}

It didn't solve the issue , still it is showing {date-1}

could you please mention why ?

Thanks


(CJ Cenizal) #6

Oh, I meant it is a bug with Kibana, but it's not a bug with your data. So you can definitely open an issue if you'd like us to improve the UI. :slight_smile:

Are there timezones associated with the dates in ES? Are they the same timezone you're in? I wonder if Kibana is adding time to account for a timezone difference.

Thanks,
CJ


(Bhavana) #7

Sure , i will open an issue on the UI part .

In the data, there is no time zones with the date field. I specified a strict_date mapping too before indexing.
Format of "date" field is "yyyy-mm-dd" .

Might be kibana is taking a default time zone it considers as "UTC" along with the date. But, my time zone is not UTC.

How could i mention to kibana to consider just the date ?

Thank you.


Wrong date shown in kibana
(CJ Cenizal) #8

Hmm OK. I'd like to verify that the timezones are the problem. Would you mind setting your system timezone to UTC to see if the makes the dates appear correctly?

If so, then we know that timezones are causing this issue. Not sure of the solution, if that's the case. I can ask some of the other engineers.


(Bhavana) #9

Yes, when i change the system time to UTC . The dates is correct in kibana.

Kibana is translating the timestamps from elasticsearch (stored as UTC) into the browser's local timezone.

So solution as mentioned in github repo is :

Kibana doesn't currently support dates without time, sending the timestamps in ISO 8601 format with the correct timezone can help elasticsearch to properly translate those times into UTC which Kibana can then properly translate into whatever the local timezone is.

I added a constant time to date field - date = date + " 12:00:00" and the below mapping

Mapping ES before indexing:

"date" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss"
}

This worked out pretty well to my time zone .


(CJ Cenizal) #10

That's great to hear! Thank you for posting your solution.

CJ


(system) #11

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.