PHPackages                             mannv-echoes/monolog-enricher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. mannv-echoes/monolog-enricher

AbandonedLibrary[Logging &amp; Monitoring](/categories/logging)

mannv-echoes/monolog-enricher
=============================

Monolog components to enable New Relic Logs

1.0.1(2y ago)071Apache-2.0PHPPHP &gt;=5.3.0

Since Jan 8Pushed 2y agoCompare

[ Source](https://github.com/mannv/newrelic-monolog-logenricher-php)[ Packagist](https://packagist.org/packages/mannv-echoes/monolog-enricher)[ RSS](/packages/mannv-echoes-monolog-enricher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (5)Used By (0)

[![Archived header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Archived.png)](https://opensource.newrelic.com/oss-category/#archived)

Monolog components to enable New Relic logs
===========================================

[](#monolog-components-to-enable-new-relic-logs)

[![Latest Stable Version](https://camo.githubusercontent.com/b0c1ec82dfd91b47fd6b55b40a2b0e1917517271ca79fc99ae1a6f642208c00a/68747470733a2f2f706f7365722e707567782e6f72672f6e657772656c69632f6d6f6e6f6c6f672d656e7269636865722f76657273696f6e)](https://packagist.org/packages/newrelic/monolog-enricher) [![Latest Unstable Version](https://camo.githubusercontent.com/529728f98b3b6761c656c3b2a260e69dad289a71dde759deba84be8474e6a526/68747470733a2f2f706f7365722e707567782e6f72672f6e657772656c69632f6d6f6e6f6c6f672d656e7269636865722f762f756e737461626c65)](//packagist.org/packages/newrelic/monolog-enricher) [![CircleCI](https://camo.githubusercontent.com/cd5631de9d42e3c2f54d917d7090efd8aafd433ad1c8ec09a5a8162cc1b9a1ec/68747470733a2f2f636972636c6563692e636f6d2f67682f6e657772656c69632f6e657772656c69632d6d6f6e6f6c6f672d6c6f67656e7269636865722d7068702e7376673f7374796c653d737667)](https://circleci.com/gh/newrelic/newrelic-monolog-logenricher-php) [![License](https://camo.githubusercontent.com/2aaf9f4a5a03433cba3422b9304ac55140e93e286b3fe70123a48a16b01350bf/68747470733a2f2f706f7365722e707567782e6f72672f6e657772656c69632f6d6f6e6f6c6f672d656e7269636865722f6c6963656e7365)](https://packagist.org/packages/newrelic/monolog-enricher)

This package provides the components required to integrate a PHP application using [Monolog](https://github.com/Seldaek/monolog) with [New Relic Logs](https://newrelic.com/products/logs).

Archival Notice
---------------

[](#archival-notice)

As of **June, 2023** the **Monolog components to enable New Relic Logs** project is archived. The [New Relic PHP agent](https://github.com/newrelic/newrelic-php-agent) (version 10.3.0 and newer) supports Monolog 2 and Monolog 3 log forwarding automatically and is the recommended way to capture log output from your PHP application. [Learn more about automatic log forwarding](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-php/#automatic-logs-in-context).

Installation
------------

[](#installation)

### Components

[](#components)

Three components are provided:

1. A [`Handler`](https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#core-concepts), which delivers log records directly from Monolog to New Relic Logs.
2. A [`Processor`](https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#using-processors). This can be used in conjunction with the [New Relic PHP agent](https://docs.newrelic.com/docs/agents/php-agent) to decorate log records with [linking metadata](https://docs.newrelic.com/docs/agents/php-agent/php-agent-api/newrelicgetlinkingmetadata), which allows you to use [logs-in-context](https://docs.newrelic.com/docs/logs/new-relic-logs/enable-logs-context/enable-logs-context-apm-agents)to correlate log records with related data across the New Relic platform.
3. A [`Formatter`](https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#customizing-the-log-format), which extends the [`JsonFormatter`](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/JsonFormatter.php)provided by Monolog to take the decorated log records from the `Processor`and output them with the [simplified JSON body structure expected by New Relic Logs](https://docs.newrelic.com/docs/logs/new-relic-logs/log-api/introduction-log-api#json-content)and [its supported plugins](https://docs.newrelic.com/docs/logs/new-relic-logs/enable-logs/enable-new-relic-logs#enable-logs).

Please see [Getting Started](#getting-started) below for more detail on how to integrate these components with your application.

### Requirements

[](#requirements)

- [Monolog](https://github.com/Seldaek/monolog), version 1 or 2.
- PHP 5.5.0 or later, although a [currently supported version of PHP](https://php.net/supported-versions.php)is strongly recommended.

To use the `Handler`, you will also need the following:

- PHP's [curl extension](https://php.net/curl).

To enable [logs-in-context](https://docs.newrelic.com/docs/logs/new-relic-logs/enable-logs-context/enable-logs-context-apm-agents)functionality, you will also need:

- The [New Relic PHP agent](https://docs.newrelic.com/docs/agents/php-agent), version 9.3 or later.

### Install

[](#install)

This package is available [on Packagist](https://packagist.org/packages/newrelic/monolog-enricher), and should be installed using [Composer](https://getcomposer.org):

```
composer require newrelic/monolog-enricher
```

Getting Started
---------------

[](#getting-started)

### Sending logs directly to New Relic Logs

[](#sending-logs-directly-to-new-relic-logs)

The simplest way to use this package is to use the `Processor` and `Handler` to send data directly to New Relic Logs:

```
