All Collections
Send your logs
Coralogix Nodejs Winston integration
Coralogix Nodejs Winston integration

Integrate your Node.js logs with Coralogix using our Winston integration

Yoni Farin avatar
Written by Yoni Farin
Updated over a week ago

Usage:

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

Company ID – A private key which is used to validate your authenticity, this key will be sent to your mail once you register to Coralogix and should not be transferred outside your company.

Private Key – A unique ID which represents your company, this Id will be sent to your mail once you register to Coralogix.

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 the Winston repository.

npm install --save coralogix-logger-winston

Winston usage example:

var winston = require("winston");
    var CoralogixWinston = require("coralogix-logger-winston");
     
    // global configuration for coralogix
    var config = {
        privateKey: "your-private-key",
        applicationName: "YOUR APP NAME",
        subsystemName: "YOUR SUBSYSTEM",
    };
     
    CoralogixWinston.CoralogixTransport.configure(config);
     
    // configure winston to user coralogix transport
    winston.configure({
        transports: [new CoralogixWinston.CoralogixTransport({
            category: "YOUR CATEGORY"
        })]
    });
     
    // use winston
    winston.info("use winston to send your logs to coralogix");
Did this answer your question?