Configure custom directory for agent logs in APM Insight Node.js agent

For Node.js applications, you can configure your own directory for your agent logs.

Note: Follow the below-given instructions for APM insight Node.js agent version 2.x.

For configuration instructions regarding APM Insight Node.js agent version 1.x, refer here

Configuration Steps for Node.js v2.x

  1. Configure the directory path of your logs in the already created apminsightnode.json file.
  2. Pass the complete path in the logsDir key.
  3. The log directory path varies based on the platform.
    • For Linux, a single forward slash will be used as the path separator.
    • For Windows, logs directory format should include a double backslash in the path separator.

Examples:

In Linux,


{

"licenseKey" : "xxxxxxxxxxxxxxxxxxxx",
"appName" : "appName",
"port" : 3000,
"logsDir" : "/Users/learn/logs"
}

 

In Windows,


{

"licenseKey" : "xxxxxxxxxxxxxxxxxxxx",
"appName" : "appName",
"port" : 3000,
"logsDir" : "C:\\users\\logs"
}

 

 The related configuration files and logs from the relevant directory are not automatically erased when the agent is uninstalled. They must be manually removed by the user.
 

APM Insight Node.js v1.x

We highly recommend you to download the lastest version of APM Insight Node.js agent. But if you are looking to download agent verison 1.x, for some specific reasons, kindly refer the below given steps. 

Configuration Steps for Node.js v1.x

  1. Configure the directory path of your logs in the first line of your node.js application startup file. 
  2. Pass the complete path in the logsDir key.
  3. The log directory path varies based on the platform.
    • For Linux, a single forward slash will be used as the path separator.
    • For Windows, logs directory format should include a double backslash in the path separator.

Examples:

In Linux,


require('apminsight')({
licenseKey : 'xxxxxxxxxxxxxxxxxxxx',
appName : 'appName',
port : 3000,
logsDir : '/Users/learn/logs'
})

 In Windows,


require('apminsight')({
licenseKey : 'xxxxxxxxxxxxxxxxxxxx',
appName : 'appName',
port : 3000,
logsDir : 'C:\\users\\logs'
})

 

 The related configuration files and logs from the relevant directory are not automatically erased when the agent is uninstalled. They must be manually removed by the user.
Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.