Generate logs for troubleshooting (Infrastructure)

Problem

When troubleshooting your Infrastructure agent, generate verbose logs for a few minutes to find and investigate errors. This can be useful for your own troubleshooting or when working with New Relic Support.

Verbose logging generates a lot of data very quickly. When finished generating logs, be sure to set verbose: 0 to reduce disk space consumption.

Solution

Generating verbose log files requires editing your configuration file; for a sample config file that includes all applicable settings, see the example template. To generate detailed logs:

Step Procedures
1.

Edit your newrelic-infra.yml file:

  1. Enable verbose logging: verbose: 1 (if you use a containerized Infrastructure agent on CoreOS, see system-specific notes).
  2. Set log_file to a convenient log file location.
  3. Restart the agent so the agent notices the new settings.
2. Let your host run at normal load for about three minutes to generate sufficient logging data.
3.

Return your settings to default:

  1. Disable verbose logging by setting verbose: 0 in newrelic-infra.yml.
  2. Optional: Disable logging to a custom file by removing the log_file line from newrelic-infra.yml.
  3. Restart the agent so the agent notices the new settings.
4.

Examine the log file for errors.

If you need to send your log file to New Relic Support:

  1. Include the line in your log file that contains the agent version:

    New Relic Infrastructure Agent version X.YY.ZZZ
  2. Attach the log file to your support ticket, along with your newrelic-infra.yml.

Notes for specific systems

These are some additional notes and requirements for specific systems, used to supplement the general logging instructions:

Containerized agent on CoreOS

If you are using a containerized Infrastructure agent on CoreOS:

  1. Choose one of these options to change the log level to verbose:

    • Recommended: Set the environment variable NRIA_VERBOSE to 1. Running this on the command line would look like:

      -e NRIA_VERBOSE=1
      

      OR

    • You can also edit the config file to set verbose: 1. However, editing the config file in a container is not recommended because it requires rebuilding the image twice: once to add verbose logging and once to remove it.

  2. Use journalctl to collect the logs:

    journalctl -u newrelic-infra > newrelic-infra.log
    
  3. Set the verbose logging level back to 0 after collecting logs for a few minutes.

For more help

Recommendations for learning more: