Enable New Relic Logs for Logstash

New Relic offers a Logstash output plugin to connect your Logstash monitored log data to New Relic Logs. This document explains how to enable this feature.

Compatibility and requirements

To use New Relic Logs with Logstash, ensure your configuration meets the following requirements:

Enable Logstash for New Relic Logs

To enable New Relic Logs with Logstash:

  1. Install the Logstash plugin.
  2. Configure the Logstash plugin.
  3. Optional: Configure additional plugin attributes.
  4. Test the Logstash plugin.
  5. Generate some traffic and wait a few minutes, then check your account for data.

Install the Logstash plugin

To install the Logstash plugin, enter the following command into your terminal or command line interface:

logstash-plugin install logstash-output-newrelic

Configure the Logstash plugin

To configure your Logstash plugin:

  1. In your logstash.conf file, add the following block of data. Be sure to replace the placeholder text with your New Relic license key or Insights Insert key.

    Configure with the New Relic license key (recommended):

    output {
      newrelic {
        license_key => "LICENSE_KEY"
      }
    }
    

    Or, configure with the New Relic Insights API Insert key:

    output {
      newrelic {
        api_key => "API_INSERT_KEY"
      }
    }
  2. Restart your Logstash instance.

Optional configuration

Once you have installed and configured the Logstash plugin, you can use the following attributes to configure how the plugin sends data to New Relic:

Property Description Default value
concurrent_requests The number of threads to make requests from. 1
base_uri The New Relic ingestion endpoint. US endpoint: https://log-api.newrelic.com/log/v1
EU endpoint: http://log-api.eu.newrelic.com/log/v1

Test the Logstash plugin

To test if your Logstash plugin is receiving input from a log file:

  1. Add the following to your logstash.conf file:

    input {
        file {
          path => "/path/to/your/log/file"
        }
    }
  2. Restart your Logstash instance.
  3. Run the following command to append a test log message to your log file:

    echo "test message" >> /path/to/your/log/file
  4. Search New Relic Logs for test message.

View log data

If everything is configured correctly and your data is being reported, you should see data logs in the New Relic Logs UI or by going to Insights and querying:

SELECT * FROM Log

What's next?

Now that you've enabled Logs, here are some potential next steps:

For more help

Recommendations for learning more: