-
Open /etc/datadog-agent/datadog.yaml in your editor of choice
-
Set
log_enabled: true -
Save and close /etc/datadog-agent/datadog.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ac_exclude: [] | |
| ac_include: [] | |
| additional_checksd: c:\programdata\datadog\checks.d | |
| api_key: paste_api_key_here | |
| bind_host: localhost | |
| cmd_host: localhost | |
| cmd_port: 5001 | |
| conf_path: . | |
| confd_path: c:\programdata\datadog\conf.d | |
| dd_url: https://app.datadoghq.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import time | |
| import requests | |
| import json | |
| ''' | |
| Set the following options in /etc/datadog-agent/datadog.yaml: | |
| # Trace Agent Specific Settings | |
| apm_config: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from checks import AgentCheck | |
| import os | |
| ''' | |
| This is for demostration purposes only and not recommended for production use. | |
| Because of the nature of ping, it could result in a very long running check if there are excessive timeouts. | |
| Long running checks could potentially result in other metrics and checks being skipped. | |
| Example conf.yaml: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import os | |
| import requests | |
| import pprint | |
| from datadog import initialize, api | |
| DD_API_KEY = os.getenv('DD_API_KEY', '<YOUR_API_KEY>') | |
| DD_APP_KEY = os.getenv('DD_APP_KEY', '<YOUR_APP_KEY>') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir /etc/datadog-agent/conf.d/logtest.d | |
| touch /etc/datadog-agent/conf.d/logtest.d/conf.yaml | |
| ##Log section | |
| logs: | |
| - type: file | |
| path: /home/vagrant/logout.log | |
| service: cawa-server | |
| source: cawa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| import time | |
| import requests | |
| import simplejson | |
| from datadog import initialize, api | |
| """ | |
| This script gives a real time report on ec2 and Datadog agent host usage | |
| from multiple organizations and reports them up to the 'main' parent account. |
The datadog agent runs under the dd-agent user and dd-agent group. This prevents dd-agent accessing the logs in /var/log as they are only accessible by root (or a sudo admin).
In order to allow read only access for dd-agent only, create ACL's and modify logrotate to persist the permissions changes.
You can manually set the ACL with:
sudo setfacl -m g:dd-agent:rx /var/log/<application-name>
This will not persist as logrotate will not re-apply the ACL setting so for a more permanent solution you can add a rule to logrotate to reset the ACL. You will need to create a new file: