pinojs / pino-elasticsearch

🌲 load pino logs into Elasticsearch
MIT License
179 stars 67 forks source link

Daily rotating dbs? #17

Open mzehrer opened 6 years ago

mzehrer commented 6 years ago

Is ist possible to create daily rotating databases with pino-elasticsearch?

alexgoldstone commented 6 years ago

I believe this will be a feature request... I came here with the same requirement...

Currently pino-elasticsearch provides a --index option.

We require an additional option to specify a time-based index.

Rather than making the format totally dynamic - I propose this is limited to daily, monthly or yearly resolution inline with the Elastic Search documentation here:

https://www.elastic.co/guide/en/elasticsearch/guide/current/retiring-data.html

Examples:

For --index logs --index-time year the index would be in the form logs_2018 For --index logs --index-time month the index would be in the form logs_2018-04 For --index logs --index-time day the index would be in the form logs_2018-04-19

tdeo commented 5 years ago

Just saw this, you can use the placeholder %{DATE} introduced in this PR: https://github.com/pinojs/pino-elasticsearch/pull/22/files

alexgoldstone commented 5 years ago

I confirm that I have been using the %{DATE} option for some time and it works well.