Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some filebeat module reports wrong year in timestamp #9995

Closed
kaiyan-sheng opened this issue Jan 10, 2019 · 7 comments
Closed

Some filebeat module reports wrong year in timestamp #9995

kaiyan-sheng opened this issue Jan 10, 2019 · 7 comments
Labels
bug Filebeat Filebeat Stalled Team:Integrations Label for the Integrations team

Comments

@kaiyan-sheng
Copy link
Contributor

kaiyan-sheng commented Jan 10, 2019

When timestamp in log entries has no year, such as 30 May 12:23:52.442, current year will be added to the timestamp. This problem originally happened in the filebeat unit tests #9849 and was fixed by removing timestamp in unit test output. Now this is happening also in users environments when year is missing in log entries. For example: elastic/kibana#28259.

@ruflin ruflin added module Filebeat Filebeat :Infra Team:Integrations Label for the Integrations team and removed :Infra labels Jan 10, 2019
@weltenwort
Copy link
Member

weltenwort commented Jan 10, 2019

Just to clarify: The missing year seems to be guessed by Elasticsearch at the indexing time because filebeat just passes through the ambiguous timestamp string. So in order to fix that on the filebeat side it would have to add the year to the timestamp before passing it on to Elasticsearch.

But then again, how would it know that it's a current and not a historic log from 10 years ago that is being read. 🤔

@kaiyan-sheng
Copy link
Contributor Author

Yeah good point. Let's say today is 01-10-2019, so if timestamp has MM-DD to be before 01-10, then gives a timestamp year as 2019. If MM-DD is larger/after 01-10, then gives a timestamp year as 2018. But as you said, it can also be logs 10 years ago instead of last year.

@jsoriano
Copy link
Member

An strategy could be to use the time of the file to obtain the year when the file was written. This may need some special handling for files written during new year, but it should work for normal logging use cases.

For historical logs whose original date is not preserved in the file we may need some extra configs, or we could document that users can modify the time of the files to the year they expect.

@ruflin
Copy link
Member

ruflin commented Jan 11, 2019

What about a log file that was created 2018-12-31 23:00 and contains events from 2018 and 2019? If we have a config or detect the file creation or change data, all events would either contain 2018 or 2019 as year.

@jsoriano
Copy link
Member

Yes, this is what I meant with needing some special handling for files written during new year 🙂 But I cannot think on a good solution 😕

We could use the year of the creation time and then increase it if on the same file we are going back to the past (to a previous month), but creation time is not usually set 🙁 this would require manual config.

Doing it the other way around (using the modification time) would require to modify events from log lines written before the change of year, or to read the file twice, with a first pass only to check if it contains a change of year.

@weltenwort
Copy link
Member

How about showing a warning to the user about ambiguous timestamps as a first step?

@botelastic
Copy link

botelastic bot commented Dec 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added the Stalled label Dec 3, 2020
@botelastic botelastic bot closed this as completed Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Filebeat Filebeat Stalled Team:Integrations Label for the Integrations team
Projects
None yet
Development

No branches or pull requests

6 participants