Overview
Scope: This guide covers the Datadog Agent, host metrics, tagging, application logs, APM, AWS/EC2 visibility, dashboards, monitors, synthetic checks, validation and troubleshooting. Container platforms such as ECS/Fargate
Datadog Architecture
The Datadog Agent runs on a host and collects infrastructure telemetry. Additional configuration enables log collection, application traces and integrations. Datadog then provides a common place to search, correlate, visualize and alert on that telemetry.
Application / OS
├── Metrics ───────────────┐
├── Logs ──────────────────┤
└── Traces (APM) ──────────┤
▼
Datadog Agent
│
HTTPS/TLS
▼
Datadog Infrastructure / Logs / APM
Prerequisites
- Datadog account and API key.
- Datadog site/region, for example datadoghq.com or datadoghq.eu.
- Linux host with sudo/root access.
- Outbound connectivity to Datadog.
- AWS Systems Manager/IAM can be used for managed installation for EC2.
Security : Keep API keys out of source control, application code, tickets and screenshots. Use your organization’s approved secret-management process.
Datadog Agent Installation
For Linux, Datadog currently recommends using the in-app Agent installation/Fleet Automation workflow to generate the correct command for your organization, site and platform. A representative Agent v7 installation command is:
DD_API_KEY=<YOUR_DATADOG_API_KEY> DD_SITE="<YOUR_DATADOG_SITE>" bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)
Do not hard-code a real API key in documentation. Prefer the command generated inside your Datadog organization.
Verify the Agent:
sudo systemctl status datadog-agent sudo datadog-agent status
Linux configuration is normally located at /etc/datadog-agent/datadog.yaml; integration configurations are under /etc/datadog-agent/conf.d/.
Useful service commands: sudo systemctl start datadog-agent sudo systemctl stop datadog-agent sudo systemctl restart datadog-agent sudo systemctl status datadog-agent sudo datadog-agent status sudo datadog-agent flare
Standard Tags Configuration
Tags make telemetry searchable and allow dashboards and monitors to be scoped by environment, service, business unit and ownership. Standardize names before onboarding many hosts.
# /etc/datadog-agent/datadog.yaml tags: - env:staging / dev / production - service:service_name - app:application_name - bu:business_unit_name tag - team:platform / team_name
Recommended baseline tags include env, service/app, team and, where appropriate, version. Avoid inconsistent values such as staging, stg and non-prod for the same environment.
sudo systemctl restart datadog-agent sudo datadog-agent status
Enabling Log Collection
Host log collection is not enabled by default. Enable it in datadog.yaml and then define the log files to collect.
# /etc/datadog-agent/datadog.yaml logs_enabled: true
Create an application-specific configuration directory:
sudo mkdir -p /etc/datadog-agent/conf.d/<integration>.d/ (running application-php,nginx,laravel etc) sudo vi /etc/datadog-agent/conf.d/<integration>.d/conf.yaml
Example file-based log configuration:
logs: - type: file path: /var/logs/nginx/*.log service: nginx source: nginx sourcecategory: sourcecode
Replace the path, service and source with your actual application values. Ensure the Agent can read the log files.
sudo systemctl restart datadog-agent sudo datadog-agent status
Generate a test log entry and verify it under Logs → Explorer. Useful filters include service:leadmacro and source:php.
Structured JSON logs are recommended for production applications because fields such as request_id, status_code and response_time can be parsed and searched. Never log secrets or unnecessary sensitive information.
Log Parsing and Enrichment
A production logging design should define service/source naming, JSON parsing, multiline handling, sensitive-data masking and retention. A useful request log might look like:
{
"level": "error",
"service": "nginx",
"env": "staging",
"request_id": "example-request-id",
"status_code": 500,
"response_time_ms": 812,
"message": "Database connection failed"
}
Use Datadog Log Explorer and pipelines/processors to extract fields and make important fields searchable. Keep the log schema consistent across application versions.
APM Configuration
Datadog APM provides service-level and distributed tracing visibility. Datadog’s current Linux getting-started path recommends Single Step Instrumentation (SSI) for supported environments.
Option A — Single Step Instrumentation: DD_API_KEY=<YOUR_DATADOG_API_KEY> DD_SITE="<YOUR_DATADOG_SITE>" DD_APM_INSTRUMENTATION_ENABLED=host bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)
SSI can install/update the Agent and instrument supported applications. Use the command generated by Datadog for your site and required SDK versions.
For applications where explicit library control is preferred, install the Datadog tracing library for the application runtime and configure the application with the required environment variables.
Option B — language-specific libraries: Example – php setup Download setup curl -LO https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php Run setup php datadog-setup.php --php-bin=all
Add tags to approcriate config files of the applications For php (ini)
DD_SERVICE=php DD_ENV=staging DD_VERSION=<APPLICATION_VERSION>
Restart the application after instrumentation and generate traffic. Then verify the service under APM → Services.
Unified Service Tagging
The goal of observability is correlation. Use consistent service/environment/version values across metrics, logs and traces so an engineer can move from an alert to a trace and then to the relevant log entry.
Metrics: env, service/app, version, team. Logs: service, source, env, version and request_id where applicable. Traces: service, env and version. Use one canonical spelling for each service and environment.
Monitor AWS / EC2
Connect the Datadog AWS integration for AWS-level metrics and events. Install the Datadog Agent on EC2 when you need host-level metrics, processes, application logs or APM from inside the instance.
AWS Account ├── AWS Integration → CloudWatch/AWS service telemetry │ └── EC2 └── Datadog Agent ├── Host metrics ├── Application logs ├── APM traces └── Process/system data
Datadog documents AWS Systems Manager as a recommended EC2 installation path when the EC2 instances have the required SSM/IAM setup.
Application Health and Synthetic Monitoring
For web applications and APIs, monitor availability as well as infrastructure. Recommended checks include:
- HTTP health/availability.
- Response time and p95/p99 latency.
- HTTP 4xx/5xx rates.
- Application error rate.
- Database/dependency errors and latency.
- Critical user journeys with synthetic tests.
For synthetic HTTP checks, define expected status codes explicitly. Redirects can be valid application behavior; configure the test to reflect the actual endpoint contract.
Basic Validation Checklist
- Agent service is running and survives restart.
- Host appears in Infrastructure.
- CPU, memory and disk metrics are visible.
- Standard tags are searchable.
- Application logs appear with expected service/source.
- Structured log fields are parsed.
- APM service appears after traffic is generated.
- Traces contain service/environment/version.
- Critical synthetic tests pass.
- Monitors have meaningful thresholds and owners.
- Alert delivery has been tested end-to-end.
Basic Troubleshooting
Agent not running
sudo systemctl status datadog-agent sudo journalctl -u datadog-agent --no-pager -n 100 sudo datadog-agent status
Logs Missing
- Confirm logs_enabled: true.
- Confirm the conf.yaml is under the expected conf.d/<integration>.d/ directory.
- Confirm the log path exists and is readable by the dd-agent user.
- Generate a fresh log line and recheck Agent status.
- Inspect Agent logs under /var/log/datadog/.
APM not enabled
- Restart the application after instrumentation.
- Confirm the Agent is healthy.
- Confirm the application is receiving traffic.
- Confirm DD_SERVICE and DD_ENV are consistent.
- Check runtime/SSI compatibility and tracing-library logs.
Best Practices | Production ready
- Use least-privilege AWS IAM permissions.
- Keep Agent versions maintained; Datadog recommends regular Agent updates.
- Standardize tags before onboarding many applications.
- Control log volume, retention and sensitive-data exposure.
- Alert on actionable conditions rather than transient noise.
- Assign an owner and runbook to critical monitors.
- Test alert delivery and recovery notifications.
- Document the final architecture and operational handover.
Conclusion
A reliable Datadog implementation is layered: install the Agent, standardize tags, collect structured logs, instrument applications with APM, connect cloud telemetry, and finally turn the signals into dashboards and actionable monitors. The operational objective is correlation—an alert should quickly lead an engineer to the affected service, trace and log evidence.
Official Datadog References https://docs.datadoghq.com/agent/