We're launching a new cybersecurity venture! Learn more about Snowbit >

Node.js Winston Node.js Winston

Last Updated: Apr. 28, 2022

To learn how more about how to get started working with Winston, check out this guide we put together.


This document includes cluster dependent URL’s. Each URL has a variable part (in Italic). Please match this part with a row entry within the following table. Copy the table row entry located under the column that matches the top level domain of your Coralogix account (.com, .in etc.). Replace the variable part of the URL with this entry.

 Elasticsearch-APISSL CertificatesCluster URL

You must provide the following four variables when creating a Coralogix logger instance.

Private Key – A unique ID that represents your company. The private key can be found under ‘settings’->’ send your logs’. It is located in the upper right corner.

Application Name – The name of your environment, for example, a company named “SuperData” would probably insert the “SuperData” string parameter or if they want to debug their test environment they might insert the “SuperData– Test”.

SubSystem Name – Your application probably has multiple components, for example: Backend servers, Middleware, Frontend servers etc. in order to help you examine the data you need, inserting the subsystem parameter is vital.

For more information on how to setup and use Winston head over to our guide as well as the Winston repository.

If your Coralogix account top level domain is not ‘.com’ set the following environment variable accordingly to the table above.

CORALOGIX_URL=https://api.Cluster URL/api/v1/logs

If you can’t set an environment variable and you need to set it within code, you can add the following lines.

const { Constants } = require("coralogix-logger");
Constants.CORALOGIX_LOG_URL = 'https://api.coralogix.us/api/v1/logs';

In this particular case, the Coralogix account end in .us so we need to use Us Cluster Endpoint.

npm install --save coralogix-logger-winston

Winston usage example:

var winston = require("winston");
    var CoralogixWinston = require("coralogix-logger-winston");
const { Constants } = require("coralogix-logger");

Constants.CORALOGIX_LOG_URL = 'https://api.coralogix.com/api/v1/logs';

    // global configuration for coralogix 
    var config = {
        privateKey: "your-private-key",
        applicationName: "YOUR APP NAME",
        subsystemName: "YOUR SUBSYSTEM",
    // configure winston to user coralogix transport 
        transports: [new CoralogixWinston.CoralogixTransport({
            category: "YOUR CATEGORY",
            handleExceptions: true
    // use winston 
    winston.info("use winston to send your logs to coralogix");

Need help? We love to assist our customers, simply reach out via the in-app chat. For more information about getting started with Coralogix, schedule a meeting with one of our experts.

On this page