Download the PHP package newrelic/monolog-enricher without Composer

On this page you can find all versions of the php package newrelic/monolog-enricher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package monolog-enricher

Archived header

Monolog components to enable New Relic logs

Latest Stable Version

This package provides the components required to integrate a PHP application using Monolog with New Relic Logs.

Archival Notice

As of June, 2023 the Monolog components to enable New Relic Logs project is archived. The New Relic 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.

Installation

Components

Three components are provided:

  1. A Handler, which delivers log records directly from Monolog to New Relic Logs.

  2. A Processor. This can be used in conjunction with the New Relic PHP agent to decorate log records with linking metadata, which allows you to use logs-in-context to correlate log records with related data across the New Relic platform.

  3. A Formatter, which extends the JsonFormatter 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 and its supported plugins.

Please see Getting Started below for more detail on how to integrate these components with your application.

Requirements

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

To enable logs-in-context functionality, you will also need:

Install

This package is available on Packagist, and should be installed using Composer:

Getting Started

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:

If the New Relic PHP agent is installed, then the Handler should be able to detect the license key from the PHP agent, and the Processor will automatically add linking metadata to log records.

If you do not use New Relic APM, you can skip pushing the processor: the Handler can operate independently.

Selectively sending log records

By default, using the Handler means that each log record will cause a HTTP request to occur to the New Relic Logs API. This may add overhead to your application if a significant number of records are logged.

Like most built-in Monolog handlers, the Handler class allows the specification of a minimum log level: log records below the given level will not be sent to New Relic. Therefore, if you don't want to see logs below WARNING, you could change the instantiation of Handler as follows:

Buffering log records to improve performance

Another way of avoiding a HTTP request for each log message that is sent is to use Monolog's built-in BufferHandler to batch log messages, and then send them in one message at the end of the request:

Manually specifying the license key and/or host

The Handler class provides methods to set the license key or the New Relic Log API host that will be used. This may be useful if the New Relic PHP agent is not installed, or if you wish to log to a different account or region.

Integrating with an existing logging tool

If you have a logging tool already configured to send logs to New Relic Logs (such as Fluentd, AWS CloudWatch, or another logging tool supported by New Relic Logs), then you may prefer to use the Processor and Formatter to send logs to that tool, rather than sending logs directly to New Relic using the Handler.

For example, if your logging tool is configured to pick up NDJSON on stderr, you could configure the logger as follows:

More information on configuring your logging tool to send logs to New Relic Logs can be found within the New Relic documentation.

Contribute

As of June, 2023 the Monolog components to enable New Relic Logs project is archived and available for cloning only. We encourage you to experiment with it in your fork however please keep in mind that there is neither a maintainer team nor support.

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

To all contributors, we thank you! Without your contribution, this project would not be what it is today.

Setting up a development environment

The development dependencies for this project are managed by Composer, and should be installed via Composer:

Coding standards

This project conforms to PSR-12, with a soft line length limit of 80 characters.

PHP_CodeSniffer is used to ensure conformity. You can run phpcs to check the current code via the following Composer script:

Alternatively, you can use phpcbf to automatically fix most errors:

When submitting a fix, please also ensure a corresponding entry has been added to the changelog.

Testing

Running unit tests

This project uses PHPUnit 4, which is the last PHPUnit version to support PHP 5.3.

You can run the test suite via Composer:

If phpdbg is available, you can also generate a code coverage report while running the test suite:

This will write a HTML coverage report to coverage/index.html.

Running integration tests

It's also possible to run a suite of integration tests against both Monolog 1 and 2 via Composer:

More information on these tests is available in the tests/integration README.

Privacy

At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise.

We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address, and email address.

For more information, review New Relic’s General Data Privacy Notice.

License

newrelic-monolog-logenricher-php is licensed under the Apache 2.0 License.

Resources


All versions of monolog-enricher with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
monolog/monolog Version ^2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package newrelic/monolog-enricher contains the following files

Loading the files please wait ....