How to install Data dog agents in Linux server

Introduction / Issue:
Monitoring Linux servers without real-time metrics and logs can delay issue detection. The challenge is setting up the Datadog Agent correctly to capture server and application logs via the console. 

Why we need to do / Cause of the issue:
In production environments, logs provide crucial insights. Without them, root cause analysis becomes difficult. By default, log collection is disabled after installing the Datadog Agent. Enabling it ensures visibility into app behavior, system performance, and troubleshooting. 

How do we solve: 

Step 1: Install Datadog Agent 

  • Get API Key: Log in to Datadog → Integrations → APIs → Create API Key 

DD_API_KEY= bash -c “$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)” 

Step 2: Enable Log Collection 

  • Edit Config File: 

sudo nano /etc/datadog-agent/datadog.yaml 

Uncomment and set:
logs_enabled: true 

  • Create Log Source Config: 

sudo mkdir -p /etc/datadog-agent/conf.d/myapp.d 

sudo nano /etc/datadog-agent/conf.d/myapp.d/conf.yaml 

Add: 

logs: 

  – type: file 

    path: /var/log/myapp.log 

    service: myapp 

    source: custom 

Step 3: Start and Verify Agent 

sudo systemctl restart datadog-agent 

sudo systemctl enable datadog-agent 

sudo datadog-agent status 

Conclusion:
By installing the Datadog Agent and configuring it for log collection, we achieved end-to-end visibility into server and application activity. This setup provides real-time monitoring, aiding in faster issue resolution and system reliability.

Recent Posts