• /
  • Log in

Integration logging recommendations

New Relic Infrastructure provides an SDK for creating an on-host integration. This document explains requirements and best practices for generating integration logs.

Logging requirements

It's up to the integration creator to decide what kind of log messages to create, and what kind of information will be useful for debugging issues. There is only one requirement for how an integration must generate logs:

  • The integration executable must write logs to standard error (stderr).

The Infrastructure agent will capture lines written to standard error and merge them into the logging stream written by the Infrastructure agent itself.

To avoid depending on third-party logging solutions, the Go integration building library provides a simple log package with the common log-levels.

Here are the recommended practices for generating integration logs:

  • By default, an integration should be "quiet." Aside from the data emitted to standard output, there should be very few logging or diagnostic messages generated.
  • It's recommended you include a verbose logging mode similar to the verbose setting in the Infrastructure agent. Include a command line switch to enable and disable verbose logging (for example, -verbose).
  • To debug your integration while the integration is running, include the verbose switch in the definition file as part of the command line to be run. This will send the verbose logs to the Infrastructure agent's own log file.
  • For general debugging purposes, New Relic recommends you use a flag that writes the standard out JSON data in human-readable "pretty-printed" form (for example, --pretty). Note that output written in a "pretty-printed" form is only for your debugging purposes and is not compatible with the Infrastructure agent.
  • Your integration should be created so that it can run on its own. If in doubt whether the integration is communicating with the Infrastructure agent, you can run the integration from the command line and see if it's producing the correct output or log messages you expect.

For information about the Go language logging package, see Logging package.

For more help

For logging for all New Relic agents, see New Relic agent logs and troubleshooting.

Create issueEdit page
Copyright © 2021 New Relic Inc.