Skip to content
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

use config field to toggle compression #358

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions book/src/sinks/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ output_path = "/var/oura/mainnet"
output_format = "JSONL"
max_bytes_per_file = 1_000_000
max_total_files = 10
compression = true
compress_files = true
```

### Section: `sink`
Expand All @@ -23,4 +23,4 @@ compression = true
- `output_format` (optional): specified the type of syntax to use for the serialization of the events. Only available option at the moment is `JSONL` (json + line break)
- `max_bytes_per_file` (optional): the max amount of bytes to add in a file before rotating it
- `max_total_files` (optional): the max amount of files to keep in the file system before start deleting the old ones
- `compression` (optional): a boolean indicating if the rotated files should be compressed.
- `compress_files` (optional): a boolean indicating if the rotated files should be compressed.
6 changes: 5 additions & 1 deletion src/sinks/logs/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ fn build_witer(config: &Config) -> Result<impl Write, Error> {
.unwrap_or(DEFAULT_MAX_BYTES_PER_FILE),
);

let compression = file_rotate::compression::Compression::OnRotate(2);
let compression = if let Some(true) = config.compress_files {
file_rotate::compression::Compression::OnRotate(2)
} else {
file_rotate::compression::Compression::None
};

let writer = FileRotate::new(output_path, suffix_scheme, content_limit, compression);

Expand Down