Skip to content

Instantly share code, notes, and snippets.

@burnsie7
Last active February 17, 2018 03:01
Show Gist options
  • Save burnsie7/cf84144c5a283ed8dcd790be3bce6c5f to your computer and use it in GitHub Desktop.
Save burnsie7/cf84144c5a283ed8dcd790be3bce6c5f to your computer and use it in GitHub Desktop.
Enabling Logs for Apache and AEM

Step 1: Enable log collection:

  1. Open /etc/datadog-agent/datadog.yaml in your editor of choice

  2. Set log_enabled: true

  3. Save and close /etc/datadog-agent/datadog.yaml

Step 2: Enable the apache integration and add the log file settings to apache.d/conf.yaml

The dd-agent user will need permissions to read the log files specified in the integrations. Please see this doc for detailed information.

Full instructions on enabling the Apache integration can be found here:

https://docs.datadoghq.com/integrations/apache/

Note that you will need to install mod_status on your Apache servers and enable ExtendedStatus.

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

  2. Open /etc/datadog-agent/conf.d/apache.d/conf.yaml in your editor of choice

  3. Configure the integration to point to your server_status url. Example:

  init_config:

  instances:
    - apache_status_url: http://example.com/server-status?auto
  1. Configure the logs section with the path to your Apache log files:
    logs:
        - type: file
          path: /data/apps/www/logs/*.log
          source: apache
          sourcecategory: http_web_access
          service: apache
  1. Save and close /etc/datadog-agent/conf.d/apache.d/conf.yaml

Step 3: Create a new integration to collect the logs for AEM.

The dd-agent user will need permissions to read the log files specified in the integrations. Please see this doc for detailed information.

  1. sudo mkdir /etc/datadog-agent/conf.d/AEM.d

  2. sudo touch /etc/datadog-agent/conf.d/AEM.d/conf.yaml

  3. Open /etc/datadog-agent/conf.d/AEM.d/conf.yaml in your editor of choice

  4. Paste the following (modify to set the service/source/category/tags to meet your needs):

init_config:
instances:

##Log section
logs:

  - type: file
    path: /data/apps/aem/author/crx-quickstart/logs/*.log
    service: AEM
    source: AEM
    sourcecategory: CMS
    tags: env:stage

  - type: file
    path: /data/apps/aem/publish/crx-quickstart/logs/*.log
    service: AEM
    source: AEM
    sourcecategory: CMS
    tags: env:stage
  1. Save and close /etc/datadog-agent/conf.d/AEM.d/conf.yaml

Step 4: Restart the datadog agent and check the status of the logs-agent

  1. sudo systemctl restart datadog-agent

  2. sudo datadog-agent status

Example output:

==========
Logs-agent
==========

  cassandra
  ---------
    Type: file
    Status: OK

    Type: file
    Status: OK

  nginx
  -----
    Type: file
    Status: OK

    Type: file
    Status: OK

If there are errors you can find details in /var/log/datadog/agent.log:

tail -f /var/logs/datadog/agent.log | grep logs-agent

Within 5 minutes logs should appear at: https://app.datadoghq.com/logs

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