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
- Configure the directory path of your logs in the already created apminsightnode.json file.
- Pass the complete path in the logsDir key.
- 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"
}
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
- Configure the directory path of your logs in the first line of your node.js application startup file.
- Pass the complete path in the logsDir key.
- 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'
})