先安裝相關的 agent
CentOS
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh sudo bash add-logging-agent-repo.sh sudo yum install google-fluentd
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh sudo bash add-logging-agent-repo.sh sudo yum install google-fluentd
sudo systemctl start google-fluentd sudo systemctl enable google-fluentd
vi /etc/google-fluentd/config.d/td-agent.conf
<source> @type tail format apache path /var/log/apache2/access.log tag apache-access </source> <source> @type tail format apache path /var/log/apache2/error.log tag apache-error </source>