This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 5. Aggregating Container Logs
5.1. Overview Copier lienLien copié sur presse-papiers!
As an OpenShift administrator, you may want to view the logs from all containers in one user interface. The currently supported method for aggregating container logs in OpenShift Enterprise is using a centralized file system. Additional supported methods are planned for inclusion in future releases.
As packaging improvements are made, these instructions will be simplified.
5.2. Using a Centralized File System Copier lienLien copié sur presse-papiers!
This method reads all container logs and forwards them to a central server for storage on the file system.
5.2.1. Installing fluentd (td-agent) on Nodes Copier lienLien copié sur presse-papiers!
Perform the following steps on each node to install and configure fluentd (td-agent):
Run the following commands:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a directory to house the logs:
mkdir -p /var/log/td-agent/tmp chown td-agent:td-agent /var/log/td-agent/tmp
# mkdir -p /var/log/td-agent/tmp # chown td-agent:td-agent /var/log/td-agent/tmp
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To allow td-agent access to the containers logs, create the /etc/sysconfig/td-agent file and ensure it contains the following:
DAEMON_ARGS= TD_AGENT_ARGS="/usr/sbin/td-agent --log /var/log/td-agent/td-agent.log --use-v1-config"
DAEMON_ARGS= TD_AGENT_ARGS="/usr/sbin/td-agent --log /var/log/td-agent/td-agent.log --use-v1-config"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following line to the /etc/td-agent/td-agent.conf file:
@include config.d/*.conf
@include config.d/*.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the /etc/td-agent/config.d/kubernetes.conf file with the following contents:
- Enable fluentd:
systemctl enable td-agent systemctl start td-agent
# systemctl enable td-agent
# systemctl start td-agent
Any errors are logged in the /var/log/td-agent/td-agent.log file.
5.2.2. Optional Method to Verify Working Nodes Copier lienLien copié sur presse-papiers!
You can optionally set up the master to be the aggregator to test and verify that the nodes are working properly.
Install fluentd (td-agent) on the master:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Ensure port 24224 is open on the master’s firewall to allow the nodes access.
Configure fluentd to aggregate container logs by adding the following line to the /etc/td-agent/td-agent.conf file:
@include config.d/*.conf
@include config.d/*.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the /etc/td-agent/config.d/kubernetes.conf file with the following contents:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable fluentd:
systemctl enable td-agent systemctl start td-agent
# systemctl enable td-agent # systemctl start td-agent
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipAny errors are logged in the /var/log/td-agent/td-agent.log file.
You should now find all the containers' logs available on the master in the /var/log/td-agent/containers.log file.