[9.5](backport #51077) Add Filestream harvester ingestion progress metrics#51838
Merged
Conversation
Add Filestream harvester ingestion progress metrics Track active harvesters by ingestion percentage so users can see which files are fully caught up, nearly caught up, or lagging. Use scanner-observed file sizes and atomic harvester offsets to avoid extra syscalls and keep the harvester read path free of shared mutex contention. GZIP files and files ignored for any reason are excluded because their progress cannot be represented accurately by plain-file offset/size comparisons. I ran the Filestream benchmark (BenchmarkFilestream) against the latest main (69c5d2b), here are the results of 10 iterations: goos: linux goarch: amd64 pkg: github.com/elastic/beats/v7/filebeat/input/filestream cpu: Intel(R) Core(TM) Ultra 9 285H │ before.txt │ after.txt │ │ sec/op │ sec/op vs base │ Filestream/1_file/inode-16 18.98m ± 3% 19.32m ± 4% ~ (p=0.684 n=10) Filestream/1_file/fingerprint-16 18.31m ± 7% 18.12m ± 4% ~ (p=0.853 n=10) Filestream/100_files/inode-16 79.06m ± 9% 82.39m ± 16% ~ (p=0.190 n=10) Filestream/100_files/fingerprint-16 79.14m ± 8% 77.90m ± 8% ~ (p=0.796 n=10) Filestream/1000_files/fingerprint-16 44.76m ± 12% 44.62m ± 8% ~ (p=0.739 n=10) Filestream/10000_files/fingerprint-16 459.6m ± 22% 448.5m ± 13% ~ (p=0.796 n=10) Filestream/line_filter/none-16 15.20m ± 23% 16.52m ± 13% ~ (p=0.436 n=10) Filestream/line_filter/include-16 16.28m ± 5% 15.39m ± 9% ~ (p=0.247 n=10) Filestream/line_filter/exclude-16 17.03m ± 10% 15.93m ± 10% -6.46% (p=0.043 n=10) Filestream/line_filter/include_and_exclude-16 15.91m ± 9% 15.37m ± 12% ~ (p=0.684 n=10) Filestream/line_filter/drop_all-16 14.16m ± 16% 13.24m ± 8% ~ (p=0.684 n=10) geomean 32.48m 32.08m -1.24% GenAI-Assisted: Yes Human-Reviewed: Yes Tool: Cursor, Model: GPT-5.5 Agent Mode Assisted-By: Cursor (cherry picked from commit 768b58b)
Contributor
🤖 GitHub commentsJust comment with:
|
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Contributor
🔍 Preview links for changed docs |
Contributor
✅ Elastic Docs Style Checker (Vale)No issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
vishaangelova
approved these changes
Jul 9, 2026
belimawr
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.
Proposed commit message
Checklist
I have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature works. Where relevant, I have used thestresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.## Disruptive User ImpactHow to test this PR locally
Run the tests
Run the focused unit tests that cover the new Filestream harvester progress metrics:
Run the broader touched package set:
Manual test
1. Create test files:
2. Write the Filebeat configuration:
filebeat.yml
The JavaScript processor intentionally busy-waits for
delay_msper event. Thiskeeps ingestion behind file growth long enough to observe the bucket gauges. Keep
delay_msbelow the processortimeout.3. Build and run Filebeat:
4. Start monitoring the metrics:
In another terminal run the following command and start watching the metrics
You should see the beginning of the metrics:
{"files_ignored":null,"files_ingested_percent_100":null,"files_ingested_percent_95_99":null,"files_ingested_percent_lt_95":null} {"files_ignored":2,"files_ingested_percent_100":0,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":0} {"files_ignored":2,"files_ingested_percent_100":0,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1} {"files_ignored":2,"files_ingested_percent_100":0,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1} {"files_ignored":2,"files_ingested_percent_100":0,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1} {"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":0} {"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":0}5. In another terminal start adding data to a file:
Substitute
/tmp/tmp.ZUzKF6JUG3/input-files/by the temp dir from step#1flog -d 0.1 -s 0.1 |tee -a /tmp/tmp.ZUzKF6JUG3/input-files/lagging.logYou will see the metrics changing as the file is ingested:
{"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1} {"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1}Let it run for a less than a minute and stop
flog, you'll see that one file progressing in ingestion until fully ingested:{"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1} {"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":1} {"files_ignored":2,"files_ingested_percent_100":1,"files_ingested_percent_95_99":1,"files_ingested_percent_lt_95":0} {"files_ignored":2,"files_ingested_percent_100":2,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":0} {"files_ignored":2,"files_ingested_percent_100":2,"files_ingested_percent_95_99":0,"files_ingested_percent_lt_95":0}6. You can also look at the monitoring logs:
Expected meaning:
complete.logwill be counted asfiles_ingested_percent_100once it has been ingested.excluded.logis ignored, so it is not counted by anyfiles_ingested_percent_*bucket.files_ignored.lagging.logis excluded from allfiles_ingested_percent_*until it is large enough to start ingestion.As you add data to
lagging.logit will start contributing to the metrics and will move through them as the data is ingested.Related issues
## Use cases## Screenshots## LogsThis is an automatic backport of pull request #51077 done by [Mergify](https://mergify.com).