-
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
[Filebeat] Journald input doesn't work in container when host systemd is too recent #30398
Comments
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
similiar/same issue here. If running the official elastic filebeat 8.0.1 container on a Fedora Core 35 host, the journald input just reads nothing without a warning or error. If I install the filebeat 8.0.1 rpm inside a fedora 35 container and use this image, the journald input works. Fedora Core 35 uses systemd 249.7 |
Same problem here, although using a Fedora container didn't help,
Host is Flatcar Container Linux which is also using systemd 249. This is my Containerfile: FROM fedora:35
RUN dnf install -y https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.1.2-x86_64.rpm systemd-devel
COPY deployment/docker/resources/filebeat.yml /usr/share/filebeat/filebeat.yml
RUN chmod 600 /usr/share/filebeat/filebeat.yml
ENTRYPOINT [ "/usr/share/filebeat/bin/filebeat", "-e", "--path.home", "/usr/share/filebeat", "--path.data", "/usr/share/filebeat/data" ] with the following config name: filebeat
filebeat.inputs:
- type: journald
id: systemd
seek: cursor
output.logstash:
enabled: true
hosts: ["${LOGSTASH_HOST}"]
logging.to_files: false
logging.level: debug
logging.metrics.enabled: false |
What we needed to mount to get Filebeat working in a Fedora 35 Container on a Fedora CoreOS 35 host:
|
thnx @vinzent! can confirm that this config in addition to defaults of the chart do the trick in kubernetes deployment:
|
Hi I am also having an issue with this but no luck if anyone has any advice or can provide me with a solution that works on their end please let me know Dockerfile
Filebeat.ymlname: filebeat
filebeat.inputs:
- type: journald
id: everything
seek: cursor
logging.to_files: false
logging.level: debug
logging.metrics.enabled: false
fields:
caas:
env: qa
region: xxx
cluster_id: xxx-xxx-xxx
source: kubernetes
geap:
version: 1
client_id: xxxx
client_secret: xxxx
region: xxxx
log_group: caas_journal_logs
env: qa
output:
logstash:
hosts:
- xxxxx
- xxxxx
- xxxxx
compression_level: 9
worker: 3
loadbalance: true
bulk_max_size: 2048 RUN on Server
ERROR MSG
|
There is no journalctl command in the base linux image, such as the fedora:35 base image in the filebeat image you are using. So you can replace the linux base image in the filebeat image with the image containing the journalctl command |
You can try it, I have solved the problem this way. I mounted the journalctl command in the fully functional linux system to the base image container, then mounted the dependencies required by journalctl, and finally executed docker commit to create a linux base image that could solve the problem |
Thank you @DYH-never-giveup can you give me an example of your config Do you have an example image I thought Fedora Core OS has journalctl installed by default in the vanilla so far I have the following: |
Yet another "we also have this issue". We switched from Ubuntu 20.04 to 22.04 on our K8s nodes and now we do not get journald entries anymore. The only solution which worked for us was to rebuild filebeat with a newer/the same Ubuntu version so that the systemd version of the host matches the one in the container, like the initial post here suggested. Non of the other shenanigans worked. Is it perhaps possible to update the Ubuntu version here: beats/dev-tools/packaging/packages.yml Lines 160 to 177 in f20ce9d
Or at least make it possible to override with an ENV var, like And what's interesting, I found out (through my quick and dirty debug app here) that although the the systemd library can read out things like the This is of course not the fault of the filebeat journald input per se (which is also still experimental), but maybe it is possible to at least warn or quit with an error when events are received but it is unable to see any content for the Nth time or so. Maybe somewhere around here: beats/filebeat/input/journald/pkg/journalread/reader.go Lines 163 to 173 in f20ce9d
Anyhow, just some ideas here. Maybe its even better to see what the underlying C library or the go bindings for it does (some uncaught error maybe?). |
We also hit that on Flatcar with k3s and filebeat 8.7.0 (using helm-chart from https://github.com/elastic/helm-charts/tree/main/filebeat). Mounted /etc/hostname, /etc/machine-id and /run/systemd as suggested with no luck (no errors in filebeat logs but also no events from journald)
|
After digging quickly through the release notes of systemd I might have found something:
Source: https://github.com/systemd/systemd/blob/main/NEWS#L4797-L4805 Newer OS versions might use a version >=v246 and the provided container image, which is based on Ubuntu 20.04, uses libsystemd v245. So this is likely why this issue occurs. Disclaimer: I was not able to test it to confirm this being the "fix" - or more like workaround for using an "ancient" version of libsystemd in the image. ;) Edit: Mb some related issues:
Edit2: I learned from fluent/fluent-bit#2998 (also related issue but different log provider), that it is also necessary to set |
I've performed some tests with different base images (ubuntu 20.04 with systemd 245 and ubuntu 22.04 with systemd 249): all tests failed, i.e. no logs from journal.
Build it with docker build docker build . -t "filebeat-20" docker-compose:
|
FYI: https://discuss.elastic.co/t/journald-input-cannot-read-read-zstd-compressed-journal/330379 According to the contribution guidelines it is necessary to discuss issues first there. Let's see ;) |
We should create Docker images with latest Ubuntu as base? |
We couldn't make filebeat's journald input work (running in a container managed by k8s).
There was nothing significant in debug logs, the only weird thing was that when we ran
lsof
on the filebeat process, it wasn't opening journal files (mounted from host).Docker image used:
docker.elastic.co/beats/filebeat-oss:8.0.0-rc2
Host systemd version:
249
We managed to fix this issue by installing a more recent version of
systemd
library in the container (ubuntu jammy ->249.9-0ubuntu2
).The text was updated successfully, but these errors were encountered: