Closed mashhurs closed 2 months ago
Failed CI will be 🟢 with 8.14.2 soon. https://github.com/elastic/logstash/pull/16255 unit test is a safeguard for such failure cases.
LGTM, just minor suggestions:
- How about adding a
debug
log here, just in case we need troubleshooting those temporary file deletions.
I once more thought and moved the removal logic in the plugin#close
. In clean_temporary_file
there are debugging log lines and LS core has also debugging log before closing the plugin as I remember.
- Could we add a test to ensure those empty files are deleted when the
close
is called?
Nice, I have just added it.
Release notes
[rn:skip]
What does this PR do?
When closing the plugin, the plugin checks if file needs to be uploaded to S3. If file is empty, it will be removed (without this change the file will be left).
Why is it important/What is the impact to the user?
For intensive S3 upload operations and rotation policy is fast (size or time), multiple files will be created. When the plugin is being closed, created but not written to files will be just left. There will be many empty files over time. Note that, we introduced separate logic to remove the empty dirs but it doesn't remove if dir has files, even empty files.
Checklist
I have made corresponding change to the default configuration files (and/or docker env variables)Author's Checklist
How to test this PR locally
./bin/logstash -f your-config-file.conf
)/elastic/s3-output/temp
temp dir that no any files left after stopping Logstash. Without this change, created but not written files will be left.Related issues
Use cases
Screenshots
Logs