Last updated 11th May 2021

Get your license key

Sign up at and get your license key.

Add your license key

Add your New Relic license key as an environment level variable:

webpaas variable:create --level environment --environment '<your-environment>' --visible-build false --inheritable false env:NEW_RELIC_LICENSE_KEY --value '<your-new-relic-license-key>'

Give your application a name

Add a new environment level variable to give your application a recognizable name:

webpaas variable:create --level environment --environment '<your-environment>' --visible-build false --inheritable false env:NEW_RELIC_APP_NAME --value '<your-application-name>'

Repeat these two steps for every environment you want to monitor, making sure you give them different application names, matching the ones you entered in the New Relic interface.

Configure the New Relic logs

Our File System being read-only, New Relic won't be able to create its log file. To allow New Relic to output logs, we need to get a writeable directory to put the log file in.

At the end of the build hook in your, create a newrelic directory in your application root:

  # ... your hooks
  build: |
    # ... your build hook
    mkdir $PLATFORM_APP_DIR/newrelic

Now add this directory to your mounts:

  # ... your mounts
    source: local
    source_path: newrelic

We now need to tell New Relic to use this file. To do that, create a new project level variable called NEW_RELIC_LOG:

webpaas variable:create --level project --visible-build false env:NEW_RELIC_LOG --value /app/newrelic/newrelic_agent.log

Set up the New Relic agent

Install the newrelic package:

npm install newrelic
# or
yarn add newrelic

Import it before any other import in your application's main module:

// or
import "newrelic";

Commit and push the changes

$ git add -A
$ git commit -m "Enable New Relic"
$ git push

Once your environment is delployed and you've generated some traffic, you need to wait a little bit for your New Relic dashboard to be created.


You can check that your application is properly connected to New Relic by looking at the /app/newrelic/newrelic_agent.log file:

$ webpaas ssh
$ cat /app/newrelic/newrelic_agent.log

{"v":0,"level":30,"name":"newrelic","hostname":"api.0","pid":761,"time":"2021-02-03T16:12:50.890Z","msg":"Connected to with agent run ID xxxxx.","component":"collector_api"}
{"v":0,"level":30,"name":"newrelic","hostname":"api.0","pid":761,"time":"2021-02-03T16:12:50.890Z","msg":"Reporting to:","component":"collector_api"}
{"v":0,"level":30,"name":"newrelic","hostname":"api.0","pid":761,"time":"2021-02-03T16:12:50.892Z","msg":"Valid event_harvest_config received. Updating harvest cycles. {\"report_period_ms\":5000,\"harvest_limits\":{\"error_event_data\":8,\"analytic_event_data\":833,\"custom_event_data\":83}}"}
{"v":0,"level":30,"name":"newrelic","hostname":"api.0","pid":761,"time":"2021-02-03T16:12:50.897Z","msg":"Agent state changed from connected to started."}
{"v":0,"level":30,"name":"newrelic","hostname":"api.0","pid":761,"time":"2021-02-03T16:12:51.899Z","msg":"Starting initial 1000ms harvest."}

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices incl. VAT may vary according to the customer's country of residence
(by default, the prices displayed are inclusive of the UK VAT in force).