Logs and metrics

Logging

Send logs from every app with one key, then search, filter and follow them live, with levels, namespaces and apps.

Send logs from your code with an SDK or one HTTP request, and they show up in Logs within a second. Every app of a domain sends with the same ingest key, and you search them all in one place.

Send logs

Copy the ingest key from Settings, keep it in LOGDASH_API_KEY and pass it to the SDK. Without a key, the SDKs write to the console only, which is handy in local development.

import { Logdash } from '@logdash/node';

const logdash = new Logdash(process.env.LOGDASH_API_KEY);

logdash.info('Application started successfully');
logdash.error('An unexpected error occurred');
logdash.warn('Low disk space warning');

Most SDKs send logs in the background. In a short-lived process, such as a cron job or a serverless function, flush before the process exits so the last logs are sent. The page of your SDK shows how.

Levels

Every log has one of seven levels. The SDKs have a method for each, and the HTTP API takes the name in level.

LevelUse it for
errorSomething failed and needs attention.
warningSomething looks wrong but still works. The SDK methods are called warn.
infoWhat your app does, such as a started job or a new signup.
httpRequests your app serves or makes.
verboseMore detail than info.
debugDetail for debugging.
sillyEverything else.

Namespaces

A namespace groups the logs of one part of your app, such as auth or billing, so you can filter by it. In the Node.js SDK, withNamespace returns a logger that adds the namespace to every log. Over HTTP, send it in namespace, up to 255 characters.

auth.ts
const authLogdash = logdash.withNamespace('auth');

authLogdash.info('User logged in');
authLogdash.error('Authentication failed');

Apps

When more than one program sends logs, name each with the app option, such as api or worker. Logdash adds the app with its first log, and Logs gets an App filter. See Apps.

worker.ts
const logdash = new Logdash(process.env.LOGDASH_API_KEY, { app: 'worker' });

Search and filter

The Logs page shows the newest logs first, with a chart of log volume above them.

  • Search logs finds logs that contain every word you type, in any case.
  • Errors and Warnings show only logs of that level, in one click.
  • The filters narrow by App, Level, Namespace and Time range. Hold ⌘ or Shift to pick more than one value.
  • Time range offers the last 15 minutes up to the last 30 days, or a Custom range. Ranges longer than the retention of your plan show Upgrade.
  • Drag across the volume chart to zoom into that time.
  • The clock button switches between relative and exact times.

Read a log

Click a log to open it with its full message, level, namespace and app. The arrow keys move to the previous or next log of the same level, so you can step through every error in a row. Press Esc to close it.

Live tail

Without a time range, new logs appear as they arrive and match your search and filters. Picking a time range stops following, and clearing it starts again. The page also pauses while its tab is hidden.

Limits

  • Messages longer than 4,096 characters are cut.
  • Each app can send a fixed number of logs per hour. The hour starts with the first log, and logs past the limit get 429 Rate limit exceeded until it ends.
  • Logs are deleted when they are older than the retention of your plan.
LimitHobbyBuilderPro
Retention1 day7 days30 days
Logs per app per hour10,00025,00050,000
Logs kept per app240k4.2M36M

For every field, the batch endpoint and the read API, see HTTP API.