-
Notifications
You must be signed in to change notification settings - Fork 67
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
Allow for Date in index #22
Conversation
@delvedor can you please check this? |
@tdeo do we need to change the docs? What's the impact of this change? |
We should indeed mention this is the docs. I'll add it to the PR. I think the change should have no user impact as elasticsearch enforces downcase indexes in the first place I'll run some benchmark to see the performance impact |
About the performance, here's a quick sample, using the following test file: Before this PR:
I suspect using the After:
There doesn't seem to be any significant performance impact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as the index name respects the index name limitations looks good to me.
Date math indexes are supported and encouraged since they are handy!
For the scope of this module though, I would suggest exposing this as an option, since it is possible that someone doesn't want this functionality 👍
@delvedor in your opinion should we favor using YYYY.MM.DD format here instead of YYYY-MM-DD since that's the default ElasticSearch expects and the default that Logstash send ? I'm not really sure that needs to be optional, nobody should be using "%{DATE}" in their index name, or in such case it's ignored by ElasticSearch as it doesn't respect the naming limitations. @mcollina what's your opinion on this option ? do you think we need to support a pattern replacement or only a command line option |
@tdeo I've seen use them both. The important thing is to be consistent, otherwise, your search experience will not be that good ;) |
@mcollina It should be good (I'm running the fork on a small webapp already and properly getting logs to ES), however, I'm not sure how much the test I added covers regarding the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a test for writev by copying what
pino-elasticsearch/test/acceptance.test.js
Line 111 in 48165b0
test('store lines in bulk', { timeout }, (t) => { |
test/acceptance.test.js
Outdated
t.deepEqual(response._source, body, 'obj matches') | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move it to the end of the file?
Logstash default option for ElasticSearch is to include the date in the index: https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-index
This is quite useful for housekeeping in general, and I'd love to see a similar feature here, I made a quick amendment to support something similar to start a discussion about that, please let me know what you think