-
Notifications
You must be signed in to change notification settings - Fork 0
add logrotate out plugin #2
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
Conversation
3b551f1
to
87e2227
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.
Pull Request Overview
This PR adds a new output plugin out_logrotate
to Fluent Bit that provides file output with automatic log rotation capabilities. The plugin extends the basic file output functionality with features like file size-based rotation, automatic compression, and cleanup of old rotated files.
- Adds logrotate output plugin with rotation, compression, and cleanup features
- Implements comprehensive test suite with multiple test scenarios
- Adds CMake build configuration and plugin registration
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 13 comments.
Show a summary per file
File | Description |
---|---|
plugins/out_logrotate/logrotate.c | Main plugin implementation with rotation logic, compression, and file management |
plugins/out_logrotate/logrotate.h | Plugin header with format enum definitions |
plugins/out_logrotate/CMakeLists.txt | Build configuration for the plugin |
tests/runtime/out_logrotate.c | Comprehensive test suite with 7 test cases |
tests/runtime/CMakeLists.txt | Test registration configuration |
plugins/CMakeLists.txt | Plugin registration in main build system |
cmake/plugins_options.cmake | Build option definition for the plugin |
conf/fluent-bit-logrotate.conf | Example configuration file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
struct tm *tm_info = localtime(&now); | ||
char timestamp[32]; | ||
|
||
strftime(timestamp, sizeof(timestamp), "%Y%m%d_%H%M%S", tm_info); | ||
|
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.
The localtime()
function returns a pointer to static data that can be overwritten by subsequent calls in multi-threaded environments. Use localtime_r()
for thread safety.
struct tm *tm_info = localtime(&now); | |
char timestamp[32]; | |
strftime(timestamp, sizeof(timestamp), "%Y%m%d_%H%M%S", tm_info); | |
struct tm tm_info; | |
char timestamp[32]; | |
localtime_r(&now, &tm_info); | |
strftime(timestamp, sizeof(timestamp), "%Y%m%d_%H%M%S", &tm_info); |
Copilot uses AI. Check for mistakes.
5388677
to
b04b49a
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.
Reviewed it together and made the edits on spot :)
* add logrotate out plugin * fix gzip * fix test * update max_size * update gzip * add logs Signed-off-by: SagiROosto <sagi.rosenthal@oosto.com>
No description provided.