Unable to see NodeJS application logs in New Relic

I have completed the guided installation for newrelic for my node application and even though I can view my system logs in the dashboard there are no logs from my node js application.
These things are done:

  1. The APM agent is latest (8.7).
  2. Node version is 14.
  3. The config file newrelic.js is on root level.
  4. Also installed and properly using @newrelic/winston-enricher for formatting the logs.

The documentations provded by newrelic are not very clear and very painstaking to understand on how to enable application logs for viewing in dashboard.

I wanted to know how can I view the node js application logs in newrelic dashboard.

Hi, @shantanu5: If you are using the Infrastructure agent to forward your system logs to New Relic, you just need to edit your logging.yml file to include the location of your application logs: Forward your logs using the infrastructure agent | New Relic Documentation

1 Like

Hi, @philweber : yes, I am using the Infrastructure agent to forward my system logs. Where does the newrelic agent store the node application’s logs in the system?

New Relic doesn’t store application logs, your application does. Where does your application write its logs?

@philweber Okay, so I think we can use winston configuration to store our application logs in desired location and then we can reference this location in logging.yml right? But does this also enable the logs in context or we will see the logs only in the infrastructure logs?

Okay, so I think we can use winston configuration to store our application logs in desired location and then we can reference this location in logging.yml right?

Correct, that will send your logs to New Relic, and you can view them in the Logs UI. To enable logs in context, follow these instructions: Node.js: Configure logs in context | New Relic Documentation.

@philweber Yes, I had already done that, it seems like adding the logs location in logging.yml did the trick, now I can view the logs in the logs UI and also in logs in context.

1 Like

@philweber thanks a lot man, you saved my day.

1 Like

That’s why we’re here! Happy to help.

1 Like