Update file_storage to write state to subdirectory#2184
Merged
Conversation
Paamicky
approved these changes
Jul 6, 2026
mitali-salvi
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue
The
logfileplugin'scleanupStateFolder()globs the state directory (logs/state/*) and deletes any file it cannot parse as its expected two-line offset format. When thejournaldreceiver uses thefile_storageextension to persist state in the same directory, the BoltDB files end up being deleted by the state directory cleanup.Description of changes
Moves the
file_storagedirectory tologs/state/otelto prevent this conflict. Sets theCompaction.Directoryto match the storage directory for consistency.License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Tested on EC2 with both
logfileandjournaldconfigured. The cleanup is non-deterministic, but is possible if thejournaldreceiver is delayed during startup.{ "agent": { "debug": true }, "logs": { "logs_collected": { "files": { "collect_list": [ { "file_path": "/var/log/messages", "log_group_name": "/test/v1-logs" } ] }, "journald": { "collect_list": [ { "log_group_name": "/test/journald", "units": ["sshd"] } ] } } } }Before
After
Requirements
Before commiting your code, please do the following steps.
make fmtandmake fmt-shmake lintIntegration Tests
To run integration tests against this PR, add the
ready for testinglabel.