Send Winston Logs to KloudMate Using OTel (Node.js)
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
In order to send these logs to KloudMate you will need to install a few helper packages.
Next, create a file customLogger.ts that will be overriding the winston logger.
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.
After starting the app, you should be able to see winston logs in your KloudMate account's Logs page.