RocksDB info log (LOG, LOG.old.*) grows without a size limit: log options are left at RocksDB defaults and cannot be configured

Issue Description

The RocksDB data store opens the database without setting any info log option, so RocksDB’s defaults apply: max_log_file_size=0 (the current LOG has no size limit), keep_log_file_num=1000 (an old LOG.old. is kept for each restart, up to 1000 files) and stats_dump_period_sec=600 (statistics are written every 10 minutes). The data directory’s info log therefore grows without a total size limit.

These options cannot be set by an administrator: the RocksDbStore settings expose only path, cacheSize, bufferSize, blobSize and poolWorkers, and the database is opened from Options::default() rather than from an OPTIONS file.

Code (v0.16.24):

  • crates/store/src/backend/rocksdb/main.rs L109-117: the database options are built from Options::default(), and no info log option is set.

The OPTIONS file RocksDB writes at open shows keep_log_file_num=1000, max_log_file_size=0 and stats_dump_period_sec=600.

Expected Behavior

The RocksDB info log stays within a bounded total size.

Actual Behavior

The current LOG grows until the next restart, each restart adds a LOG.old. file, and up to 1000 such files are kept, so the total size has no limit.

Reproduction Steps

  1. Run Stalwart v0.16.24 with the RocksDB data store.
  2. Read the OPTIONS-* file in the data directory: keep_log_file_num=1000, max_log_file_size=0, stats_dump_period_sec=600.
  3. Restart Stalwart a few times: each restart leaves a new LOG.old., none is removed, and LOG keeps growing between restarts.

Stalwart Version

v0.16.x

Installation Method

Binary (Linux)

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

Additional Context

rust-rocksdb already exposes set_max_log_file_size and set_keep_log_file_num, and both are needed to bound the total size of the info log. One option could be to enable this size-based rotation with a finite number of retained files by default, so the bound needs no configuration.

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

This confirms the report is accurate: the code indeed opens RocksDB with Options::default() and never calls set_max_log_file_size or set_keep_log_file_num, so the info log is unbounded and there’s no config exposed for it.

I can confirm this matches the code in crates/store/src/backend/rocksdb/main.rs: the db_opts are built from Options::default() with no calls to set_max_log_file_size or set_keep_log_file_num, so RocksDB’s defaults (unbounded LOG, up to 1000 LOG.old.* files) apply and there is no administrator-facing setting to change this. This is a valid report of real behavior rather than a documentation gap, so I’ll leave it for a human/staff follow-up rather than guess at a fix timeline.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

I already run into this ( How to change RocksDB option keep_log_file_num - #2 by helpbot ), i use a script/systemd-timer now to cleanup the old logs.

Yeah, didn’t see that post. I will do that as well if it’s not implemented natively at some point.

Fixed in v0.16.25 (will be released today).

Thank you for all the fixes in 0.16.25. :+1:

Do we get a config option or just a lower default?

And Yes, thanks for addressing this!