I'm using docker-compose.yml that launches my services. All services look something like this:
A-service:
image: A-service
restart: always
network_mode: host
logging:
driver: journald
options:
tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
fluent-bit:
image: 'bitnami/fluent-bit:latest'
restart: always
network_mode: host
command: /fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit.conf
volumes:
- ./service/config/fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
- type: bind
source: /run/log
target: /run/log
When I run journalctl -e -f -u docker
I see all the logs being logged just fine.
The problem I'm having is that my fluent-bit container seems to be unable to get any data when collecting from systemd:
fluent-bit.conf:
[SERVICE]
Flush 5
Daemon Off
Log_Level debug
[INPUT]
Name systemd
Tag *
[OUTPUT]
Name stdout
Match *
I figured that it might be because it's in container and can't reach the logs location, but binding directory /run/log:/run/log
had no effect.
So my question would be: Can fluent-bit reach systemd and read journal when it is inside container? If yes - how can I achieve that?
After even more research I stumbled acros this thread: https://github.com/fluent/fluent-bit/issues/497
Long story short:
so:
Then, in fluent-bit.conf you need edit the INPUT path: