node.js – New Relic nodejs logs only showup when NEW_RELIC_NO_CONFIG_FILE=true
I’m trying to setup new relic for my Nodejs application, I have added newrelic.js at root of my repo, imported newrelic on first line and using "newrelic": "9.15.0",I can see application metrics on newrelic dashboards, but i’m not able to see any logs on new relic, If I set the env variable NEW_RELIC_NO_CONFIG_FILE=true then i can see the logs.
newrelic.js
{
agent_enabled: process.env.NODE_ENV === "prod",
app_name: ["Demo-Service"],
license_key: "my key",
logging: {
enabled: true,
level: "info",
},
allow_all_headers: true,
ignore: ["*/live", "*/ready"],
attributes: {
exclude: [
"request.headers.cookie",
"request.headers.authorization",
"request.headers.proxyAuthorization",
"request.headers.setCookie*",
"request.headers.x*",
"response.headers.cookie",
"response.headers.authorization",
"response.headers.proxyAuthorization",
"response.headers.setCookie*",
"response.headers.x*",
],
},
}
newrelic_agent.log
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.461Z","msg":"Using New Relic for Node.js. Agent version: 9.15.0; Node version: v16.19.0."}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.491Z","msg":"Using LegacyContextManager"}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.492Z","msg":"Adding destroy hook to clean up unresolved promises.","component":"async_hooks"}
{"v":0,"level":40,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.508Z","msg":"The newrelic module must be the first module required.\nThe following modules were required before newrelic and are not being instrumented:\n\tfastify: /{path}/node_modules/fastify-plugin/plugin.js\n\tmongodb: {path}/node_modules/mongodb/lib/index.js\n\taws-sdk: {path}/node_modules/aws-sdk/lib/aws.js\n\tq: {path}/node_modules/pino/pino.js"}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.508Z","msg":"Agent state changed from stopped to starting."}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.512Z","msg":"Starting New Relic for Node.js connection process."}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:36.512Z","msg":"Agent state changed from starting to connecting."}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:39.462Z","msg":"Agent state changed from connecting to connected."}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:39.462Z","msg":"Connected to collector-004.newrelic.com:443 with agent run ID {some_id_here}.","component":"collector_api"}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:39.463Z","msg":"Reporting to: https://rpm.newrelic.com/accounts/{number}/applications/{number}","component":"collector_api"}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:39.466Z","msg":"Valid event_harvest_config received. Updating harvest cycles. {\"report_period_ms\":5000,\"harvest_limits\":{\"error_event_data\":8,\"log_event_data\":833,\"analytic_event_data\":833,\"custom_event_data\":250}}"}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:39.471Z","msg":"Agent state changed from connected to started."}
{"v":0,"level":30,"name":"newrelic","hostname":"host-local","pid":18262,"time":"2023-04-18T23:19:40.472Z","msg":"Starting initial 1000ms harvest."}
what am i missing here?
Read more here: Source link
