Skip to content

Commit

Permalink
chore: update newrelic gem to support log forwarding (chatwoot#4626)
Browse files Browse the repository at this point in the history
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: chatwoot#4625
  • Loading branch information
vishnu-narayanan authored May 5, 2022
1 parent 832a0f2 commit 66d366f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 18 additions & 0 deletions config/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 66d366f

Please sign in to comment.