Retention

7 Best Tools for Long Term Log Retention

Seven tools for long term log retention that balance storage cost and search, from logrotate and rsyslog to Loki, OpenSearch, Elasticsearch and rclone.

On this page
  1. Key takeaways
  2. Why retention needs a plan
  3. Quick comparison
  4. The best tools for long term log retention
  5. How we chose
  6. FAQ
  7. Sources

Key takeaways

  • logrotate and rsyslog manage retention at the file and transport level.
  • Loki, OpenSearch, Elasticsearch, and Graylog keep retained logs searchable.
  • rclone moves archived files to cheap remote storage.
  • Retention is a balance between storage cost and how searchable old logs must be.

Why retention needs a plan

Logs accumulate fast, and keeping everything forever costs money in disk and backups. A retention plan decides how long each kind of log is kept, where it lives, and when it is deleted.

The tools below handle different stages: rotating local files, moving logs to a central store, indexing them for search, and archiving to cheap object storage. Together they make long term retention practical.

Quick comparison

ToolBest forStarting priceFree plan
logrotateRotating filesNot includedNot included
rsyslogForwarding to storageNot includedNot included
LokiCheap log storageNot includedNot included
OpenSearchIndexed retentionNot includedNot included
ElasticsearchSearchable retentionNot includedNot included
GraylogRetention policiesNot includedNot included
rcloneArchiving to object storageNot includedNot included

The best tools for long term log retention

1. logrotate

logrotate is a utility that manages log files by rotating, compressing, and deleting them on a schedule. It runs automatically and keeps a set number of old files, which stops a single log from filling a disk. Rules are set per file, so retention length and compression are easy to tune.

logrotate is the first layer of retention on most Linux systems, since it works on local files before anything is shipped. It can run a command after rotation, such as telling a service to reopen its log, and its rules run from a plain configuration file. For simple, local, cost free retention, logrotate is the standard starting point.

2. rsyslog

  • Official site: https://www.rsyslog.com/
  • Best for: Forwarding to storage
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Built in; modular
  • Cons: Basic parsing; limited shaping

rsyslog collects log messages on a host and can forward them to a central server or long term store. Its rules decide which messages go where, so older or less critical logs can be sent to cheaper storage. It also supports buffering and retries when the destination is slow or offline.

rsyslog works with databases and files as well as remote syslog, which gives teams a few retention options. Because it ships with most Linux distributions, adding it to a retention plan is usually a small change, and reliable delivery keeps messages from being lost in transit. It is the common transport that moves logs into whatever store holds them long term.

3. Loki

  • Official site: https://grafana.com/oss/loki/
  • Best for: Cheap log storage
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Low cost; label based
  • Cons: Less deep search; fewer indexes

Loki is a log aggregation system built for low cost, long term storage. It stores logs by label and keeps messages in object storage such as S3, which is cheaper than a full search index. Retention rules then age old data out on a schedule.

Loki keeps recent logs searchable in Grafana while older chunks stay cheap in object storage. Teams that need months or years of logs without a large index bill often choose it, since they can keep far more history for the same budget. Its design trades some search depth for a much smaller storage cost, which fits retention well.

4. OpenSearch

  • Official site: https://opensearch.org/
  • Best for: Indexed retention
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Searchable; tiered
  • Cons: Needs tuning; careful sizing

OpenSearch is a search engine that can hold long term log data in indexed form, so old logs stay fully searchable. It supports index lifecycle policies that roll data from hot to warm to cold tiers, and it can move older indices to object storage with the right setup.

OpenSearch suits teams that want retained logs to remain queryable in detail, not just archived. Its dashboards also let operators run searches and alerts over historical data, and tiering moves older data to cheaper storage as it ages. The cost is that full indexing needs more storage than plain archives, so teams balance search depth against price.

5. Elasticsearch

  • Official site: https://www.elastic.co/elasticsearch
  • Best for: Searchable retention
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Tiered; deep search
  • Cons: Heavy to run; resource hungry

Elasticsearch stores and searches log data at scale, and it offers lifecycle management to move older indices to cheaper tiers. Hot, warm, cold, and frozen layers let a team keep recent logs fast and old logs on slower storage. This keeps long term retention affordable while search still works.

Elasticsearch is a common choice when retained logs must stay searchable for compliance or debugging. Shippers feed it continuously, and Kibana or Graylog provide the interface. Its tiering is the main way teams keep years of data without paying for full speed on all of it, and each tier trades query speed for lower cost.

6. Graylog

  • Official site: https://graylog.org/
  • Best for: Retention policies
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Central control; alerts
  • Cons: Needs a backend; setup required

Graylog is a log management platform that includes retention policies for its stored messages. Administrators can set how long each index or stream is kept, and old data is deleted or moved automatically. This keeps the store from growing without bound.

Graylog sits on top of Elasticsearch or OpenSearch, so its retention rules work through those engines. It also lets a team route some logs to longer retention while others age out sooner, and admins can set rules per stream without editing index settings by hand. For a platform that manages both search and retention in one UI, Graylog is a solid fit.

7. rclone

  • Official site: https://rclone.org/
  • Best for: Archiving to object storage
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Many backends; encryption
  • Cons: Command line only; no GUI

rclone is a command line tool that syncs files to many kinds of remote storage, including S3, Google Drive, and other object backends. Teams use it to copy rotated or old log files off servers and into cheap, durable archives. It supports encryption and can run on a schedule.

rclone fits the last stage of retention, when logs are compressed and moved to long term cold storage. It handles large transfers with checks, resuming interrupted jobs, and scheduled jobs can run the copy automatically. For teams that keep raw log files as archives, rclone is a dependable way to get them off the server.

How we chose

These tools cover the full retention path, from local rotation to central indexing and cold archiving. The list includes both search oriented stores and plain file movers because retention needs both live search and cheap storage.

Preference went to tools that let a team set explicit retention rules and lower costs as data ages. Each one helps keep the right logs for the right amount of time.

FAQ

How long should logs be kept?

The answer depends on compliance and debugging needs. Many teams keep recent logs searchable and older logs in cheaper archives for a shorter window, and compliance rules often set the minimum for certain log types.

What is the cheapest way to store old logs?

Compressed files in object storage through tools such as rclone cost the least. Loki also offers a cheap, searchable middle ground, while plain archives are not quickly searchable.

Can retained logs still be searched?

Yes, engines such as Elasticsearch and OpenSearch keep old logs queryable. Loki keeps them searchable with lower storage cost but less deep indexing, while indexed search costs more storage but answers queries in detail.

What is index lifecycle management?

It is a way to move older log indices to cheaper storage tiers automatically. Elasticsearch and OpenSearch both support this pattern, keeping recent data fast while old data stays cheap.

Where does logrotate fit in retention?

logrotate rotates, compresses, and deletes local files on a schedule. It is the first line of defense before logs are shipped or archived, and after rotation the compressed files can be archived or deleted.

Sources