Skip to content

Configuration

Configure LogNorth for your environment

Configure LogNorth for your environment.

Environment variables for the LogNorth server:

VariableDescriptionDefault
LOGNORTH_PORTHTTP port8080
LOGNORTH_STORAGE_PATHData directory/data

Get notified when errors occur. Choose your notification channel in Settings.

Free push notifications to your phone or desktop. No account required.

  1. Install the ntfy app on your phone or desktop
  2. Subscribe to a topic with a random name (e.g., lognorth-abc123)
  3. In LogNorth Settings, select “ntfy.sh” and paste the URL: https://ntfy.sh/lognorth-abc123

Use your own mail server for email alerts.

SettingDescription
SMTP HostYour SMTP server (e.g., smtp.gmail.com)
SMTP PortUsually 587 (TLS) or 465 (SSL)
SMTP UsernameYour email or SMTP username
SMTP PasswordYour email password or app password
From AddressSender email address
To AddressWhere to send alerts

Every API request requires an API key in the Authorization header:

Terminal window
Authorization: Bearer YOUR_API_KEY

Create API keys in the LogNorth web UI under Settings.

One schema for everything — HTTP requests, business events, errors, background jobs.

FieldTypeDescription
messagestringRequired. What happened.
timestampstringISO 8601. Always set by the SDK.
duration_msintHow long it took (set by middleware).
trace_idstringGroups related events. Auto-generated per request by middleware.
contextobjectAll metadata. Any key-value pairs you want.

HTTP request (sent by middleware automatically):

{
"message": "POST /users → 201",
"timestamp": "2024-01-15T10:30:00Z",
"duration_ms": 45,
"trace_id": "a1b2c3d4e5f67890",
"context": {
"method": "POST",
"path": "/users",
"status": 201
}
}

Business event (your code, inside a request):

{
"message": "User signed up",
"timestamp": "2024-01-15T10:30:00Z",
"trace_id": "a1b2c3d4e5f67890",
"context": {
"user_id": 123,
"plan": "pro"
}
}

Same trace_id as the HTTP request — automatic when using middleware.

Error (SDK captures everything):

{
"message": "Checkout failed",
"timestamp": "2024-01-15T10:30:00Z",
"trace_id": "a1b2c3d4e5f67890",
"context": {
"error": "connection refused",
"error_class": "ConnectionError",
"error_file": "checkout.go",
"error_line": 42,
"error_caller": "processPayment",
"stack_trace": "..."
}
}

Background job (no request context):

{
"message": "SendWeeklyDigest completed",
"timestamp": "2024-01-15T10:30:00Z",
"duration_ms": 3200,
"context": {
"job": "SendWeeklyDigest"
}
}
  • timestamp is always set by the SDK. Never set it manually.
  • trace_id is auto-generated per request by middleware. All logs within the same request share it.
  • duration_ms is top-level, not in context. Set automatically by middleware.
  • Background jobs don’t get a trace_id unless you’re inside middleware.

Context is a flat JSON object. Put anything in it. Some keys have special meaning:

KeyTypeWhat it does
methodstringHTTP method. Shown in the log UI.
pathstringRequest path. Shown in the log UI.
statusintHTTP status. >= 500 marks the event as an error.
jobstringBackground job name. Shown instead of method/path.
errorstringError message. Marks the event as an error.
error_classstringError type (e.g. TypeError). Marks as error. Used for issue grouping.
error_filestringSource file. Used for issue grouping.
error_lineintLine number. Used for issue grouping.
error_callerstringFunction name. Shown on issue detail.
stack_tracestringFull stack trace. Shown on issue detail.

Everything else (user_id, ip, order_id, whatever you send) is stored and searchable.

SDKs populate the error fields automatically when you call error(). You don’t set them manually.

LogNorth automatically sets is_error = true when:

  • context.error exists and is not empty
  • context.error_class exists and is not empty
  • context.status >= 500

No need to manually flag errors.

Configure how long to keep events in Settings. Options: 7 days, 30 days, 90 days (default), 6 months, 1 year, or forever.

Older events are automatically deleted daily. Set to “Forever” to disable automatic deletion.

LogNorth uses SQLite. One file. Simple to backup, move, or restore.

Size per event: ~0.3 KB average

TrafficEvents/day90 days1 year5 years
Low1,00025 MB100 MB500 MB
Medium5,000125 MB500 MB2.5 GB
High20,000500 MB2 GB10 GB

A $5 VPS with 25GB storage handles years of data for most apps.

Your database lives on your server. If the server dies, data dies too.

Pick one off-server strategy:

StrategyEffortProtection
VPS snapshotsLowYour provider handles it. Enable weekly snapshots in your VPS dashboard.
rsync to another serverMediumCron job copies database nightly.
LitestreamMediumReal-time replication to S3. Point-in-time recovery.

VPS snapshots are the simplest. Most providers (Hetzner, DigitalOcean, Linode) offer them for a few dollars/month.

Litestream streams every SQLite change to S3-compatible storage. See litestream.io.