[Filebeat/Journald] Add support for watching folders#46682
Merged
belimawr merged 8 commits intoelastic:mainfrom Sep 19, 2025
Merged
[Filebeat/Journald] Add support for watching folders#46682belimawr merged 8 commits intoelastic:mainfrom
belimawr merged 8 commits intoelastic:mainfrom
Conversation
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`.
Contributor
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Contributor
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Member
|
@belimawr a suggestion, when decompressing the files, pass in the |
AndersonQ
approved these changes
Sep 19, 2025
Contributor
|
@Mergifyio backport 8.18 8.19 9.0 9.1 |
Contributor
✅ Backports have been createdDetails
|
mergify bot
pushed a commit
that referenced
this pull request
Sep 19, 2025
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5)
6 tasks
mergify bot
pushed a commit
that referenced
this pull request
Sep 19, 2025
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5)
mergify bot
pushed a commit
that referenced
this pull request
Sep 19, 2025
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5)
This was referenced Sep 19, 2025
mergify bot
pushed a commit
that referenced
this pull request
Sep 19, 2025
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5)
6 tasks
belimawr
added a commit
that referenced
this pull request
Sep 22, 2025
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5) Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
belimawr
added a commit
that referenced
this pull request
Sep 22, 2025
This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5) Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
belimawr
added a commit
that referenced
this pull request
Sep 22, 2025
…olders (#46717) This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5) --------- Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
belimawr
added a commit
that referenced
this pull request
Sep 22, 2025
…olders (#46718) This commit implements the use of `--directory` argument when calling `journalctl`, thus allowing it to watch for new files in the folder. This is implemented by calling `os.Stat` on the path and checking if it is a folder, if so, then `--directory` is used instead of `--file`. (cherry picked from commit 8af95b5) --------- Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
Merged
8 tasks
This was referenced Sep 26, 2025
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 changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.## Disruptive User Impact## Author's ChecklistHow to test this PR locally
Testing in Kubernetes to ingest node logs
Start a Kind cluster
Deploy the Elastic Stack, make sure it will be accessible from inside the Kind cluster
I use my own fork of
elastic-packageto bind on all interfaces.Build Filebeat docker image
Load the image into your Kind cluster
Deploy Filebeat reading from
/run/log/journalNote that the journald configuration points to the folder
/run/log/journalfilebeat-kubernetes.yaml
Ensure the logs are coming in in Kibana
filebeat-9.2.0Using journal files
Decompress all
journal?.journal.gzfiles and prepare the destination folderStart Filebeat with the following configuration
filebeat.yaml
Start monitoring the stats endpoint for published events
You will see a JSON like:
{ "active": 0, "added": 0, "done": 0 }Keep an eye in the
donecounter, that's the number of published events.Move the first journal file to
/tmp/journaldand wait until all events are publishedWait untill the
donecounter is 10.Repeat the process for the other two journal files
There are 10 entries in each file, so at the end of the test, there should be 30 published files.
Related issues
## Use cases## Screenshots## Logs