Using DataDog on your CentOs

DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=<your-key> DD_SITE="datadoghq.eu" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"

sudo nano /etc/datadog-agent/datadog.yaml
# uncomment logs_enabled: true
sudo systemctl restart datadog-agent
sudo mkdir /etc/datadog-agent/conf.d/go.d
sudo nano /etc/datadog-agent/conf.d/go.d/conf.yaml
# and add contents from the url below

https://app.datadoghq.eu/logs/onboarding/server
https://docs.datadoghq.com/agent/faq/error-restarting-agent-already-listening-on-a-configured-port/

Or, if you want a dockerized version of DataDog agent, and you want to listen to docker logs, you can do this:

docker run -d --name datadog-agent \
           -e DD_API_KEY=<DATADOG_API_KEY> \
           -e DD_LOGS_ENABLED=true \
           -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true \
           -e DD_CONTAINER_EXCLUDE_LOGS="name:datadog-agent" \
           -e DD_SITE="datadoghq.eu"  \
           -v /var/run/docker.sock:/var/run/docker.sock:ro \
           -v /proc/:/host/proc/:ro \
           -v /opt/datadog-agent/run:/opt/datadog-agent/run:rw \
           -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
           datadog/agent:latest

More info here — https://docs.datadoghq.com/agent/docker/log/?tab=containerinstallation

Then you will see your logs here — https://app.datadoghq.eu/logs

LEAVE A COMMENT