Posts tagged “Logging”
W3C Trace Context in Node.js: correlating requests across services with traceparent
Three services, three log streams, one failed order, and nothing to join them on. W3C Trace Context gives every hop the same trace ID. Here is how to propagate traceparent in Node with OpenTelemetry, or in 30 lines without it.
What small Node teams should log in the AI-attack era
Bots are now more than half of web traffic, and 27% of attacks target APIs and identity systems. You don't need a security team to see it, just the right fields on every request. Here's the minimum to capture, five patterns to watch, and when to block.
API log retention and cost: how much request logging a small team needs
Either the logging bill surprises you or the logs are gone when a customer asks about last month. Here is a retention policy a small team can set up in an afternoon.
Node.js log levels that mean something: a logging policy for small teams
At 3am your error log is full of scanner 404s and the real database timeout is buried. Here is a Node.js log levels policy a small team can paste into its repo, plus the code that enforces it.
Fastify hooks for logging and auth: onRequest, preHandler and onResponse explained
Auth checks that run before the body exists, log lines missing the status code, handlers that run after a 401: most come from using the wrong Fastify hook. Here is which hook does which job in Fastify v5, with working code.
Credential stuffing detection for Node APIs: spotting it in your login logs
Every request looks like a normal login, which is why stuffing goes unseen until a customer reports a login they did not make. Here is how to see it in your logs.
How to log outbound HTTP requests in Node.js
Your API threw 502s because a provider was timing out, and your logs said nothing. Log outbound HTTP requests from fetch and axios with diagnostics_channel in an afternoon, then read error rate and p95 per host.
How to redact sensitive data in logs for Node.js APIs
Found a bearer token in your logs? Here's how to keep secrets and personal data out of Node API logs in an afternoon: Pino redaction, URL and error scrubbing, body allowlists and a test that catches leaks.
AsyncLocalStorage request IDs: follow one request through a Node.js API
A customer says checkout failed at 2pm and your logs are fifty requests interleaved. Add request IDs with AsyncLocalStorage in Express or Fastify in an afternoon, and every log line, response and downstream call carries the same ID.
Pino logging in Node.js: a practical structured logging setup for Express and Fastify
A customer says invoices failed yesterday and your logs are a wall of console.log. Set up Pino logging for Express or Fastify in an afternoon: JSON lines, request IDs, levels by status, redaction and a team checklist.