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
Incorrect weekly index name YYYY-52 for events on 1st Jan when using logstash-%{+YYYY.ww} pattern? #541
Comments
Thanks @joshuar . A small note: Events from Jan 2, 2017 are indexed correctly because Jan 2 happens to be Monday which is first day of week. Until the first day of week is encountered, I believe it will continue to log into |
This is not a bug. You can even have a 53 week year in the ISO standard: https://en.wikipedia.org/wiki/ISO_week_date |
Hi @untergeek - I do get your point that there can be 53 weeks in a year. But in that case, it should log in |
@sandeepkanabar Your confusion is understandable, but the format fields in Joda behave indepedently. The format The differences between weekyear and year are important here and honestly have confused me in the past :) January 1 2017 for format From the joda docs:
Here's an example in irb showing this in action:
This is something easy for users to stumble over, I agree. |
This is a rare one, for sure. Seems like it's not a bug, so we'll close this for now. |
Thank you @jordansissel for the clarification. Can you please let me know how I can run and verify myself? I launched irb but when i run the above command I get |
@sandeepkanabar I provided an example in irb because, for me, that was the shortest path. The exact same library is used for Logstash to format dates. you can verify this with Logstash instead using @joshuar's example at the top of this issue. The change you should is the following to @joshuar's example Logstash configuration: - index => "logstash-%{+YYYY.ww}"
+ index => "logstash-%{+xxxx.ww}" If you wish to reproduce this with |
Thanks for the explanations @untergeek and @jordansissel! |
@jordansissel thanks for the pointer on |
Today I hit on this problem too. |
Version: 5.1.1
Operating System: Fedora Linux 25
Description:
It looks like when using the index pattern name
logstash-%{+YYYY.ww}
, i.e., a weekly time-based pattern, events from the 1st Jan of the year are incorrectly indexed into aYYYY-52
index rather than aYYYY-01
index. Events from the 2nd Jan are correctly indexed into the latter.Steps to Reproduce:
Consider the following configuration:
Note the index pattern:
"logstash-%{+YYYY.ww}"
And the following log file:
Note we have two log lines on both the 1st and 2nd of Jan
Running Logstash on this file with
cat test.log | /path/to/logstash -f ./logstash.conf
results in the following documents indexed in Elasticsearch:The two log lines from the 1st Jan are indexed into a
logstash-2017.52
index?Attached is the config and test log:
test-log-and-config.zip
The text was updated successfully, but these errors were encountered: