How to configure logs file location in newrelic.js to point to a Kubernetes volume

9/18/2021

We are setting up a new node.js project with a New Relic agent so that we can collect and forward the application logs as per docs.

Currently the path for the logs is configured in newrelic.js for this project like so:

filepath: require('path').join(process.cwd(), 'newrelic_agent_btt-data-api.log'),

and that generates a log in the current directory of the project.

We would like to be able to set the above configuration such that we it's pointing it to a Kubernetes mount, say in the form of:

volumes:
        - name: newrelic-volume
          emptyDir: {}

volumeMounts:
          - mountPath: /var/newrelic
            name: newrelic-volume

How would the above filepath in the newrelic.js need to change to accommodate for this?

Thank you in advance.

-- Simeon Leyzerzon
kubernetes
newrelic
node.js

0 Answers