OpenTelemetry Support
Using OpenTelemetry SDKs

Send Winston Logs to KloudMate Using OTel (Node.js)

2min

In this guide, we will see how your existing apps that are already using winston for logging can send those logs to KloudMate with minimal changes.

Let's consider a simple Express app that logs some data using winston. This app writes logs to the console.

index.ts

TypeScript


In order to send these logs to KloudMate you will need to install a few helper packages.

Shell


Next, create a file customLogger.ts that will be overriding the winston logger.

TypeScript


Here we are overriding the info and error methods so that they also emit logs to KloudMate. You will have to replace KM_PRIVATE_KEY with your KloudMate workspaces's private key. With this in place, we can replace the winston logger in index.ts with the new modified logger.

TypeScript


After starting the app, you should be able to see winston logs in your KloudMate account's Logs page.