-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Disk queue re-sends last segment file when there is more than on segment on disk #32560
Comments
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
@leehinman I think we will want to address this as part of the work to support the disk queue under agent. CC @faec if you have any idea on a possible root cause. |
Just tried this (it still reproduces on current main branch) and it looks like the problem is not in the disk queue per se but in the beats shutdown: nothing ever calls Once the queue realizes the metadata on the segment file is incomplete, it rescans the file and sends all the events (it's a conservative approach, if there is data there it sends it unless we're certain that it's already been sent, and the conflicting metadata prevents that). So the root cause looks like something in the pipeline that isn't propagating the shutdown signal to the queue. |
(In particular though, this means that we're unlikely to see this in the shipper since our shutdown process there is entirely different.) |
Hi! We're labeling this issue as |
Hello, |
When using the disk queue, when Filebeat is restarted and a new event is sent, the disk queue creates a second segment file, if both are present, whenever Filebeat is restarted, the last event is always re-sent.
7.17.5
andmain
(confirmed on those versions)The original Discuss Topic contains the steps to reproduce using the file output, here I used the console output, either way works (aka, the bug is reproducible)
Steps to Reproduce:
1. Use the config below and start Filebeat.
2. Add a line to the log file.
Contents of the log file (
/tmp/test.log
):You will see a event in the console with the line that was added to the file.
The disk queue folder (
./data/diskqueue
) contains two files:3. Enter a second line to the log file:
Contents of the log file (
/tmp/test.log
):You will see a event in the console with the line that was added to the file.
4. Restart Filebeat
No changes in the files/folders
5. Add a new log line
Contents of the log file (
/tmp/test.log
):You will see a event in the console with the line that was added to the file.
The diskqueue creates a new segment file, now there are two:
5. Restart Filebeat
You will see the last event sent (
2022-07-29 09:01:00.000 0000003
).Every time you restart Filebeat the same event will be sent.
6. Keep sending events and restarting filebeat
If we send more events, the current segment files are deleted, a new one created. Whenever there is only one segment file, no duplicated data is sent.
If Filebeat is restarted once more, a second segment file will be created, and while there are two segment files, the last segment file will always be sent when Filebeat restarts.
Logs and observations
When there are two segment files in the diskqueue and Filebeat starts, the "last segment" seems to be resent before the registry is started, the diskqueue also logs a negative number of events:
Found -4 existing events on queue start
.Here are some debug logs being sent to stderr with the console output enabled: filebeat.log
The text was updated successfully, but these errors were encountered: