From 66d366f0ff7768d4df154b731d80fb1ac73bc5c9 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Thu, 5 May 2022 23:57:55 +0530 Subject: [PATCH] chore: update newrelic gem to support log forwarding (#4626) Newrelic gem 8.7 has application log forwarding support and this is enabled by default. Update the gem to make use of this feature. Chatwoot have turned this off by default though. Set `NEW_RELIC_APPLICATION_LOGGING_ENABLED` to enable this feature. Make sure to disable another log forwarding services you have to prevent duplicated logs. ref: https://docs.newrelic.com/docs/release-notes/agent-release-notes/ruby-release-notes/ruby-agent-870 Fixes: #4625 --- .env.example | 4 +++- Gemfile.lock | 2 +- config/newrelic.yml | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index cc7e1c2dd..d46acac9f 100644 --- a/.env.example +++ b/.env.example @@ -161,13 +161,15 @@ USE_INBOX_AVATAR_FOR_BOT=true ## NewRelic # https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration/ # NEW_RELIC_LICENSE_KEY= +# Set this to true to allow newrelic apm to send logs. +# This is turned off by default. +# NEW_RELIC_APPLICATION_LOGGING_ENABLED= ## Datadog ## https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#environment-variables # DD_TRACE_AGENT_URL= - ## IP look up configuration ## ref https://github.com/alexreisner/geocoder/blob/master/README_API_GUIDE.md ## works only on accounts with ip look up feature enabled diff --git a/Gemfile.lock b/Gemfile.lock index ba8f04ec9..1e2147bc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -376,7 +376,7 @@ GEM net-http-persistent (4.0.1) connection_pool (~> 2.2) netrc (0.11.0) - newrelic_rpm (8.4.0) + newrelic_rpm (8.7.0) nio4r (2.5.8) nokogiri (1.13.4) mini_portile2 (~> 2.8.0) diff --git a/config/newrelic.yml b/config/newrelic.yml index 3ac93158f..f07ea34e6 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -24,6 +24,24 @@ common: &default_settings # Logging level for log/newrelic_agent.log log_level: <%= ENV.fetch('NEW_RELIC_LOG_LEVEL', 'info') %> + application_logging: + # If `true`, all logging-related features for the agent can be enabled or disabled + # independently. If `false`, all logging-related features are disabled. + enabled: <%= ENV.fetch('NEW_RELIC_APPLICATION_LOGGING_ENABLED', false) %> + forwarding: + # If `true`, the agent captures log records emitted by this application. + enabled: true + # Defines the maximum number of log records to buffer in memory at a time. + max_samples_stored: 30000 + metrics: + # If `true`, the agent captures metrics related to logging for this application. + enabled: true + local_decorating: + # If `true`, the agent decorates logs with metadata to link to entities, hosts, traces, and spans. + # This requires a log forwarder to send your log files to New Relic. + # This should not be used when forwarding is enabled. + enabled: false + # Environment-specific settings are in this section. # RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment.