I am trying to configure an APM agent in my nodejs application code. I have installed the APM agent using the following command:
npm install elastic-apm-node --save
I then updated my application code using the following template:
// Add this to the VERY top of the first file loaded in your app
var apm = require('elastic-apm-node').start({
// Override the service name from package.json
// Allowed characters: a-z, A-Z, 0-9, -, _, and space
serviceName: 'my-service-name',
// Use if APM Server requires a secret token
secretToken: '',
// Set the custom APM Server URL (default: http://localhost:8200)
serverUrl: 'http://localhost:8200',
// Set the service environment
environment: 'my-environment'
})
But when I start up my application, the following is logged to the console:
{"log.level":"error","@timestamp":"2023-02-22T23:47:33.876Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error: error fetching APM Server version: connect ECONNREFUSED ::1:8200"}
{"log.level":"error","@timestamp":"2023-02-22T23:47:33.877Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error (ECONNREFUSED): connect ECONNREFUSED ::1:8200"}
{"log.level":"error","@timestamp":"2023-02-22T23:47:33.977Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error (ECONNREFUSED): connect ECONNREFUSED ::1:8200"}
{"log.level":"error","@timestamp":"2023-02-22T23:48:03.885Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error (ECONNREFUSED): connect ECONNREFUSED ::1:8200"}
I'm not sure why I'm receiving these error messages or what to do about them.