Breaking News from AWS re:Invent
Coralogix receives AWS Rising Star award!

Back to All Integrations

Node.js Winston Node.js Winston

Last Updated: Jun. 29, 2023

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


This document includes cluster dependent URLs. Each URL has a variable part (in Italic). Please match this part with a row entry within the following table. Please Replace the “Cluster URL” in the “usage example” with the URL that matches the domain of your Coralogix account (.com, .in etc.).


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

Private Key – Your Send-Your-Data API key is a unique ID that represents your company.

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.

Winston usage example:

const os = require("os");
const winston = require("winston");

const logger = winston.createLogger({
    transports: [
        new winston.transports.Http({
            name: "coralogix",
            level: "info",
            format: winston.format((info) => ({
                applicationName: "nodejs",
                subsystemName: "winston",
                computerName: os.hostname(),
                severity: {
                    silly: 1,
                    debug: 1,
                    verbose: 2,
                    info: 3,
                    warn: 4,
                    error: 5,
                    critical: 6
                }[info.level] || 3,
                text: info.message,
            host: "<CLUSTER_URL>",
            path: "/logs/rest/singles",
            headers: {
                "private_key": "<your-send-your-data-api_key>"
            ssl: true,
            batchInterval: 1000,
            handleExceptions: true
    exitOnError: false
});"My info log line");

Note: If using TypeScript, set the ‘esModuleInterop’ configuration option to true in your tsconfig.json to allow imports of both CommonJS (os) and ES6 (winston) modules, as both are used in the example code.


Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].

On this page