Skip to content

Instantly share code, notes, and snippets.

@burnsie7
Last active February 7, 2018 17:25
Show Gist options
  • Save burnsie7/81af209a9c40212266e846aa60416ff0 to your computer and use it in GitHub Desktop.
Save burnsie7/81af209a9c40212266e846aa60416ff0 to your computer and use it in GitHub Desktop.
Log Monitoring Setup

Log Monitoring Notes

Important - A valid log config needs to be found in an integration yaml file before logs-agent will start.

Support training exercise:

https://docs.google.com/document/d/1FZWWDak01pXXB9JACUTbIzgLAaoAT4gSZ5lLBjgkJ_s/edit#heading=h.h489z9dybrci

ssh -i ~/.ssh/support-sandbox-demo.pem -l ubuntu hostname

ssh hostname

Install and config nginx

sudo apt-get update

sudo apt-get install nginx

/etc/nginx/sites-enabled/default

    location /nginx_status {
        stub_status on;

        access_log off;
        allow 127.0.0.1;
        deny all;
    }

sudo nginx -s reload

Install Datadog Agent

sudo DD_API_KEY=REDACTED bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"

datadog.yaml

# The host of the Datadog intake server to send Agent data to
dd_url: https://app.datadoghq.com
api_key: <redacted>
hostname: fse-ldmx-f7-18
log_enabled: true
metadata_collectors:
  - name: 'resources'
    interval: 60

log_level: debug
log_file: /var/log/datadog/agent.log

sudo cp /etc/datadog-agent/conf.d/nginx.d/conf.yaml.example /etc/datadog-agent/conf.d/nginx.d/conf.yaml

/etc/datadog-agent/conf.d/nginx.d/conf.yaml

init_config:

instances:
  - nginx_status_url: http://localhost/nginx_status/

logs:
  - type: file
    path: /var/log/nginx/access.log
    service: nginx
    source: nginx
    sourcecategory: http_web_access

  - type: file
    path: /var/log/nginx/error.log
    service: nginx
    source: nginx
    sourcecategory: http_web_access

sudo systemctl datadog-agent restart

verified integration working:

https://cl.ly/1N0X2e0m0H0W

tail agent.log

tail -f /var/log/datadog/agent.log | grep 'logs-agent\|Logs Agent'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment