Answer the question
In order to leave comments, you need to log in
Why is the Docker container not sending logs?
Good day, there was such a problem. I raise a container on the server that should send logs to Graylog. The latter sees the connection perfectly, but it does not receive logs, what can be done about it?
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: "{{ container_state | default('started') }}"
log_driver: "{{ logdriver_type }}"
log_options: "{{ options_on_logdriver }}"
vars:
container_name: nginx
container_image: nginx:1.17.8
list_of_deployment_configuration_paths:
- ./:/etc/nginx/conf.d/
logdriver_type: syslog
options_on_logdriver:
syslog-address: "tcp://ip:port"
tag: myservice
Answer the question
In order to leave comments, you need to log in
1. if you have a graylog - you can use the GELF driver
2. for the graylog to receive logs - you need to configure the so-called INPUT with the appropriate parameters - one, two - allow connections to them outside the firewall or, if the graylog is in the container, add the appropriate ports to the forwards
3. other things being equal, I recommend using the journald driver, because it does not break the docker logs command - it will be possible to look at the logs locally + it has a bunch of other things like rate limit, rotation and other things, which allows you to ensure the minimum impact of the logs on the host system. And from journald, you can set up forwarding to graylog - as a bonus, you will receive a message from the host machine itself (as if its logs are of no interest to anyone)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question