Start your 14-day free trial today & Get 20% Off All Annual Managed ELK Plans

No Credit Card Required

Try Logit.io Free

Already have an account? Sign In

Send data via Node.js to your Logstash instance provided by Logit.io

Winston Logstash Config For Node.js

Ship logs from your Node.js application to logstash

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.

Step 1 - InstallingCopy

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 winston@2.4.1
npm install winston-logstash@0.4.0

Step 2 - Sending LogsCopy

No input available! Your stack is missing the required input for this data source Talk to support to add the input

Step 3 - Node.JS Logging OverviewCopy

Node.js is an open-source server-side platform built using JavaScript & was developed in 2009 by Ryan Dahl. As Node.js uses an event-driven, I/O model it is highly suited to powering real-time applications including live chat & chatbots, automatically refreshing feeds for social media, and additionally, it is increasingly used for sending web push notifications. It is most commonly run on Linux & Windows operating systems.

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.

Toggle View

Expand View

Return to Search