Node.js Log Monitoring with LogMonitor
>_ why node.js apps need log monitoring
Node.js servers handle thousands of concurrent requests, and a single uncaught exception can cascade into downtime. Traditional log files grow quickly and are painful to search. LogMonitor streams every log line to a Live Console so you can spot errors the moment they happen, not hours later when a user complains.
>_ how logmonitor works with node.js
Install the logmonitor-js SDK and call logmonitor.init() at the top of your entry file. The SDK auto-patches console.log, console.info, console.warn, console.error, and console.debug to stream logs to LogMonitor in real time. It works with Express, Fastify, Koa, Hapi, or any Node.js framework with zero additional configuration. Logs are only sent in production (when process.env.NODE_ENV === 'production').
>_ quick start
import { logmonitor } from 'logmonitor-js';import express from 'express';logmonitor.init({ apiKey: 'your-api-key' });const app = express();app.get('/api/users', (req, res) => { console.log('Fetching users', { ip: req.ip }); res.json({ users: [] });});app.use((err, req, res, next) => { console.error('Unhandled error', { message: err.message, stack: err.stack }); res.status(500).json({ error: 'Internal server error' });});app.listen(3000);>_ what you can monitor
- $HTTP request and response logs
- $Unhandled exceptions and promise rejections
- $Database query errors and slow queries
- $External API call failures
- $Memory usage and event loop lag warnings
- $Authentication and authorization failures
>_ frequently asked questions
Yes. The logmonitor-js SDK is framework-agnostic. It instruments console methods at the Node.js level, so it works with Express, Fastify, Koa, Hapi, NestJS, and any other Node.js framework.
Console.error calls are captured automatically. For uncaught exceptions and unhandled promise rejections, add standard Node.js process event listeners that log the error with console.error and they will appear in your Live Console.
Virtually none. The SDK sends logs asynchronously in batches, so it never blocks the event loop or adds latency to your request handling.
Yes. You can configure a custom transport in Winston or Pino to also write to console, and LogMonitor will capture those logs. Alternatively, use the SDK directly for targeted log calls.
Yes. Pass an object as the second argument to any console method and it will be sent as structured metadata. You can then filter and search by those fields in the dashboard.