Logentries supports Logging using node.js. Event-driven I/O server-side JavaScript environment based on V8.

Create Account

If you have not done so already, you will need to create a Logentries account. Just click the ‘Sign up’ button at the top of this page and register your email address. An email with instructions on how to complete your account creation will be sent to you.

Create Destination

node.js Log Management FrameworkTCP and finally click the Register new log button. A token will be displayed in green. Please record it as we will use it later to configure the library. Log in to Logentries and create a new log by clicking the Create Log button as shown in the figure on the right. Now click Manual Configuration button from the list of options. Give your log a name of your choice, select Token 


Run the following command to install node.js library:
npm install le_node
and place the following line in the dependencies of your package.json file.
"le_node": "0.2.1"

Configure in your code

var logentries = require('le_node');
var log = logentries.logger({
The LOGENTRIES_TOKEN parameter needs to be replaced with the token for the logfile we created earlier. If you haven’t taken note of the token when creating your log, you can retrieve it by logging in to Logentries. Once logged in, select the host containing the log for which you want to retrieve the token (e.g. from the side bar on the left hand side of the page). All the token-based logs of this host are then displayed with a Token icon on the right hand side. Click this icon to display the token.

Insert Logging Code

The module provides you with a set of logging methods that correspond to the standard syslog log levels. These are, in order of increasing severity: debug, info, notice, warning, err, crit, alert, emerg.


// level specific methods like 'info', 'debug', etc."I'm a Lumberjack and I'm OK")

// generic log method, also accepts JSON entries
log.log("debug", {sleep:"all night", work:"all day"})
For more details on using the node.js wrapper see our node.js Github Page. Note the module is also compatible with the Winston.

Watch Your Logs

After some log events were produced, you can log on to the Logentries web site and select the logs that you want to consult. node.js Log Management FrameworkHit the refresh button at the top right corner of the Logentries UI to see your latest log events. It can take a few seconds before log events appear.
Back to Top