-
Notifications
You must be signed in to change notification settings - Fork 253
feat(server): implement log rotation based on size and retention #2452
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: master
Are you sure you want to change the base?
Conversation
|
I think changes in |
…retention - Configurable maximum log size and retention period from server configuration - Optimized single directory traversal for collecting file information - Eliminated redundant metadata() calls for improved performance - Enhanced error handling with detailed logging for all failure cases - Merged directory traversals into a single operation to improve performance Fixes apache#46, detail changes can be found at apache#2452.
Yes, that was the case. I have just rebased it to the correct state. |
…retention - Configurable maximum log size and retention period from server configuration - Optimized single directory traversal for collecting file information - Eliminated redundant metadata() calls for improved performance - Enhanced error handling with detailed logging for all failure cases - Merged directory traversals into a single operation to improve performance Fixes apache#46, detail changes can be found at apache#2452.
8a52d32 to
a1c8c0f
Compare
…retention - Configurable maximum log size and retention period from server configuration - Optimized single directory traversal for collecting file information - Eliminated redundant metadata() calls for improved performance - Enhanced error handling with detailed logging for all failure cases - Merged directory traversals into a single operation to improve performance Fixes apache#46, detail changes can be found at apache#2452.
9180baf to
b2ca864
Compare
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.
I tested your code manually. In server.toml i changed settings to:
max_file_size = "1 MB"
max_total_size = "10 MB"
rotation_check_interval = "1 s"then I rebulilt server and started it via:
RUST_LOG=trace target/debug/iggy-server --with-default-root-credentials --fresh
and in other shell i run benchmark to generate logs:
target/debug/iggy-bench -T 1000MB pp -p 1 tcp
result:
I can never see more than 2 files, it looks like retention is ignored and 10 MB of max total size is not reached.
can you write integration test that would test for this scenario? see how TestServer is used, in integration module (e.g. core/integration/tests/server/specific.rs)
- implemented log rotation based on size and retention as the title; - implemented configurable attributions and imported breaking changes; - added units and integration test in logger.rs and intergration mod; - added documentations and imported new dependencies, etc. Details can be looked up at Apache Iggy apache#2452
|
Hi, I've completed some initial modifications and added integration tests. I first manually observed the runtime behavior locally by running in the terminal: eza -la with 10:100.rw-r--r--@ 2.4M svecco 11 Jan 13:10 iggy-server.log
.rw-r--r--@ 10M svecco 11 Jan 13:04 iggy-server.log.1
.rw-r--r--@ 10M svecco 11 Jan 13:04 iggy-server.log.2
.rw-r--r--@ 10M svecco 11 Jan 13:04 iggy-server.log.3
.rw-r--r--@ 10M svecco 11 Jan 13:04 iggy-server.log.4
.rw-r--r--@ 10M svecco 11 Jan 13:04 iggy-server.log.5
.rw-r--r--@ 10M svecco 11 Jan 13:04 iggy-server.log.6
.rw-r--r--@ 10M svecco 11 Jan 13:03 iggy-server.log.7
.rw-r--r--@ 10M svecco 11 Jan 13:03 iggy-server.log.8
.rw-r--r--@ 10M svecco 11 Jan 13:03 iggy-server.log.9Additionally, the result of the simple integration test Console╭─ $ [svecco] ~/A/iggy git!(46-size-logs)
╰─ > cargo test -p integration server::specific::log_rotation_should_launch -- --nocapture
Compiling libz-sys v1.1.23
Compiling liblzma-sys v0.4.4
Compiling hwlocality-sys v0.6.4
Compiling libgit2-sys v0.18.3+1.9.2
Compiling liblzma v0.4.5
Compiling hwlocality v1.0.0-alpha.11
Compiling compression-codecs v0.4.35
Compiling async-compression v0.4.36
Compiling async_zip v0.0.18
Compiling git2 v0.20.3
Compiling vergen-git2 v1.0.7
Compiling server v0.6.1-edge.3 (/home/svecco/host/apache/iggy/core/server)
Compiling integration v0.0.1 (/home/svecco/host/apache/iggy/core/integration)
Finished `test` profile [unoptimized + debuginfo] target(s) in 7.71s
Running unittests src/lib.rs (target/debug/deps/integration-375a7f260e09ad62)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/mod.rs (target/debug/deps/mod-0f48c9a972f7dba1)
running 1 test
Log directory verified: local_data_136642763006894046097605999160554396417/logs
Succeeded Verified Log Rotation
test server::specific::log_rotation_should_launch ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1190 filtered out; finished in 2.12s |
Redirected from issue #46 , the progress:
_install_log_rotation_handlerfunction, which was previously marked astodo;cleanup_log_filesto delete logs based on the configured time threshold & size;metadata()calls by collecting data in single traversal;Before merge:
Plan:
Around the next several weekends.