Already have an account? Sign In
The example code used in this guide has been setup using Node.js v8.11.3 (64-bit). Node Package Manager (npm) can be used to install the required
winston (2.4.1) and
winston-logstash (0.4.0) packages.
These will allow us to send log data from our Node.js application, to Logstash using the example code used in this guide has been setup using Node.js v8.11.3 (64-bit). Node Package Manager (npm) can be used to install the required winston (2.4.1) and winston-logstash (0.4.0) packages. These will allow us to send log data from our Node.js application, to TCP with SSL enabled.
The official winston 2.x documentation can be found here.
First, ensure that you have downloaded and installed Node.js (32 or 64 bit). You can get it from the official website, here.
Inside your project directory, open a terminal of your choice and type the following:
npm install email@example.com npm install firstname.lastname@example.org
Winston is the most popular logging library for Node.js as it makes logging more flexible & can be configured to multiple levels.
Winston is well known for its robust feature set & easy installation which we have detailed in this configuration guide. Morgan is commonly used in association with Winston and operates as an HTTP request logger middleware for Node.js.
Parsing, transforming & analysing emergency, critical & error Node.js logs can be hard to perform at scale from the default logging format. Priority messages can easily get lost in the noise of other logging formats (such as Info & Notice) and are not alerted on to be resolved by your wider DevOps team.
Logit.io provides a complete Node.js log analyser by default as part of our log management platform, this includes alerting, collection & visualisations enhancing your text logs to provide data-driven insights & real-time log tailing.
If you need any more assistance with migrating your Node.js data to Logstash we're here to help. Just get in contact with our support team via live chat & we'll be happy to assist.