-
Notifications
You must be signed in to change notification settings - Fork 38
Implement configurable native size/time log rotation & deletion #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,8 +61,12 @@ Where persistent data is stored. Defaults to `~/.ldk-server/` on Linux and | |
|
|
||
| ### `[log]` | ||
|
|
||
| Log level and file path. The server reopens the log file on `SIGHUP`, which integrates with | ||
| standard `logrotate` setups. | ||
| Controls logging behavior. By default, `log_to_file` is `true` and logs are also written | ||
| to `stdout`/`stderr`. | ||
|
|
||
| If `log_to_file` is enabled, the server performs internal rotation and retention | ||
| based on `max_size_mb`, `rotation_interval_hours`, and `max_files`. The server will | ||
| also reopen the log file on `SIGHUP` for compatibility with external tools like `logrotate`. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, it seems we're now no longer compatible with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We still are, I added that back in 42cd66a.
Yes, we rotate ourselves when
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But how would the user disable our internal log rotation if they use |
||
|
|
||
| ### `[tls]` | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,17 @@ The server handles `SIGTERM` and `CTRL-C` (SIGINT). On receipt, it: | |
|
|
||
| ### Log Rotation | ||
|
|
||
| > **Important:** LDK Server does not rotate or truncate its own log file. Without log rotation | ||
| > configured, the log file will grow indefinitely and can eventually fill your disk. A full | ||
| > disk can prevent the node from persisting channel state, risking fund loss. | ||
| By default, LDK Server logs to `stdout`/`stderr`. When running under `systemd` or Docker, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, here we say that by default we log to stdout/stderr, but above we say |
||
| this allows the environment (e.g., `journald`) to handle persistence, rotation, and | ||
| compression automatically. | ||
|
|
||
| The server reopens its log file on `SIGHUP`. This integrates with standard `logrotate`. Save | ||
| the following config to `/etc/logrotate.d/ldk-server` (adjust the log path to match your | ||
| setup): | ||
| If you enable `log_to_file` in the configuration, LDK Server will automatically rotate | ||
| logs when they exceed 50MB or 24 hours (configurable) and keep the last 5 uncompressed | ||
| log files. | ||
|
|
||
| If you prefer to use system `logrotate` for file logs, the server still reopens its log | ||
| file on `SIGHUP`. Save the following config to `/etc/logrotate.d/ldk-server` | ||
| (adjust the log path to match your setup): | ||
|
|
||
| ``` | ||
| /var/lib/ldk-server/regtest/ldk-server.log { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Alignment of comments is off.