Log Management

Note: For general log management feature documentation, see the Log Management features page.

Installation

AIf you haven't already, set up Scout APM for Node.js.

BGet your Logs Ingest Key from the Logs page in the Scout UI.

CEnable log management in your Scout configuration:

// scout.js
const { init } = require("@scout_apm/scout-apm");

init({
    name: process.env.SCOUT_NAME || "my-app",
    key: process.env.SCOUT_KEY,
    monitor: true,
    logsMonitor: true,
    logsIngestKey: process.env.SCOUT_LOGS_INGEST_KEY,
});

Or via environment variables:

export SCOUT_LOGS_MONITOR=true
export SCOUT_LOGS_INGEST_KEY=your-logs-ingest-key

DDeploy!

Configuration Options

Only logsIngestKey is required. The rest are optional.

Setting Name Description Default Required
logs_monitor Enable log forwarding false Yes
logs_ingest_key Ingest key from the Logs page in Scout UI Yes
logs_capture_level Minimum severity level to capture (trace/debug/info/warn/error/fatal) debug No
logs_capture_console Patch global console methods true No
logs_reporting_endpoint_http OTLP HTTP endpoint https://otlp.scoutotel.com:4318/v1/logs No

Supported Loggers

Logger Minimum Version Node.js Requirement
pino 8.0.0 ≥ 20.0.0
winston 3.0.0 Any
console Any

Scout hooks into pino via diagnostics_channel (no module patching), wraps winston.createLogger at require-time, and patches global console methods. scout.js must be required before pino or winston.

Request Context

Inside a Scout-tracked request, every log is automatically enriched with scout_transaction_id (the active request ID) and any attributes set via api.Context.add:

await api.Context.add("userId", req.user.id);
await api.Context.add("plan", req.user.plan);

logger.info("Processing order"); // userId and plan appear as OTLP attributes

Data Retention

Scout retains log data for 14 days.

Troubleshooting

Contact support@scoutapm.com if issues persist.