Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

YourSurpriseCom/monolog-dd-udp-handler

Open more actions menu

Repository files navigation

Monolog Datadog UDP Handler

workflow Minimum PHP Version phpstan License: MIT

Overview

This Monolog handler will send the messages to the dd-log-proxy over UDP and the dd-log-proxy will send the messages over TCP to the Datadog API.

Datadog Log Proxy

This handler is build to use in conjunction with the Datadog Log Proxy written in go. The proxy can be run as a container next to you application as a sidecar or as a standalone service.

One proxy for all applications

As this handler gather the information from the current trace, only one proxy is needed for all your applications. The logs will be connected to the correct trace and service.

Usage

Install the package using composer: composer require yoursurprisecom/monolog-dd-udp-handler

Simply create the handler with the proxy hostname and port, and push the handler into monolog:

<?php

use Monolog\Logger;
use YourSurpriseCom\Monolog\DatadogUdp\Handler\DataDogUdpHandler;

$logger  = new Logger('my_logger');
$handler = new DataDogUdpHandler("<proxy host>",1053);
$logger->pushHandler($handler);

$logger->info("This log message is sent non blocking over UDP to Datadog!");

Data flow

The data flow is as following:

+-----+       +-------------------------+             +--------------+             +-------------+ 
| PHP |  ==>  | Monolog Datadog Handler |  ==> (UDP)  | dd-log-proxy |  ==> (TCP)  | Datadog API |
+-----+       +-------------------------+             +--------------+             +-------------+ 

Datadog

This handler uses the Datadog PHP ddtrace package to gather information about the current span and trace. Logs will be connected to the trace in the UI.

It will also create its own Datadog service log-proxy with it own spans.

About

Monolog Datadog UDP Handler

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.