internetitem / logback-elasticsearch-appender

Logback Elasticsearch Appender
Other
233 stars 137 forks source link

Does logback-elasticsearch-appender support TTL? #59

Closed PhanNN closed 5 years ago

PhanNN commented 5 years ago

As title, does logback-elasticsearch-appender suport TTL? We don't need to save all logs and I can't find any attribute related to doc or index TTL.

abatkin commented 5 years ago

I believe that some (older) versions of ElasticSearch support per-index TTLs, but that's all server-side (i.e. not from the individual log entries). At least for logs, most people end up with time-based indices, like maybe one index per date (logs-20190121) and then just drop entire dates once they are no longer needed.

PhanNN commented 5 years ago

@abatkin : and we need cronjob or something handle this job instead of ES?

abatkin commented 5 years ago

There are a few ways to handle this - a cron job and API calls could certainly work. In past lives, I have used Curator, and there is also a good blog entry from the ES blog about techniques to handle the whole lifecycle of time-based indices.

PhanNN commented 5 years ago

Oh, Thanks @abatkin 👍