Skip to content

Conversation

@cristian-porta
Copy link
Contributor

@cristian-porta cristian-porta commented Nov 17, 2025

This PR adds an optional, eventually more flexible way to organize local logs. Deployments can choose to keep the current flat directory structure or enable date based sharding if needed

High volume installations can accumulate very large numbers of log segments in a single log_dir, which may makes traversal and retention inefficient if files are not cleared or moved quickly, even when they are kept on the machine for days/weeks for troubleshooting

This PR introduces strftime based directory patterns (e.g. /var/log/kumo/%Y/%m/%d/), usable globally or per-record type, so logs can be split by date without changing the default behavior. Patterns are parsed once at config load and reused for each write. Directory and filename resolution supports UTC (default) or the server's local timezone.

I also ran stress tests and did not observe any significant performance impact

Random snip for example:

log_dir = '/var/tmp/kumo-logs/%Y/%m/%d/',
log_dir_timezone = 'UTC', -- or Local
	per_record = {
	  Reception = {
	    log_dir = '/var/tmp/kumo-logs/%Y/%m/%d/reception/%H',
	    suffix = '_recv',
	  },
	  Bounce = {
	    log_dir = '/var/tmp/kumo-logs/%Y/%m/%d/bounce',
	    suffix = '_bounce',
	  },
	},

$ tree
.
└── 2025
    └── 11
        └── 17
            ├── reception
            │   └── 11
            │       ├── 20251117-110133.970137223_recv
            │       ├── 20251117-110143.978919004_recv
            │       ├── 20251117-110153.983676028_recv
            │       └── ...
            ├── bounce
            │   ├── 20251117-110134.005559998_bounce
            │   ├── 20251117-110144.008736923_bounce
            │   └── ...
            ├── 20251117-110134.005559998
            ├── 20251117-110144.008736923
            └── ...

@cristian-porta
Copy link
Contributor Author

Conflict resolved on crates/kumod/src/logging/files.rs due to commit 5926112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant