Datadog


1Presentation

Datadog is a service that allows − in particular − to centralize the logs of your applications within a single interface. This can be very handy when your web application is spread across multiple servers and it becomes difficult to track multiple log files simultaneously.


2Configuration

In the etc/temma.php configuration file, add the \Temma\LogManagers\Datadog object to the logManager directive.

You must also add an x-datadog extended configuration, with the following keys:

  • url: (required) Datadog API connection URL, depending on the location you chose
    • EU: https://http-intake.logs.datadoghq.eu/api/v2/logs
    • US: https://http-intake.logs.datadoghq.com/api/v2/logs
    • US3: https://http-intake.logs.us3.datadoghq.com/api/v2/logs
    • US5: https://http-intake.logs.us5.datadoghq.com/api/v2/logs
    • US1-FED: https://http-intake.logs.ddog-gov.com/api/v2/logs
  • apiKey: (required) Your API key
  • service: (optional) Name of the service (website or application) sending the log

Here is an example configuration:

<?php

return [
    'application' => [
        'logManager' => '\Temma\LogManagers\Datadog'
    ],
    'x-datadog' => [
        'url'     => 'https://http-intake.logs.datadoghq.eu/api/v2/logs',
        'apiKey'  => '...API_KEY...',
        'service' => 'temma.net',
    ]
];

3Usage

In the Datadog web interface, it is recommended to create two facets:

  • Traceid, which will contain a string of four characters, allowing to identify the logs coming from the same execution.
  • Class, which will contain the log recording class.

You can add these facets as columns in the general monitoring table, this will make reading the log stream more explicit.