Skip to main content
Railway has no built-in log drain. Connect your Railway account to let Squasher pull logs and metrics for one Railway project, or send errors, logs, and traces from inside each service with a Squasher SDK or OpenTelemetry. You can use both.

Connect a Railway project

  1. Open your project in Squasher and select Settings in the sidebar, then the Integrations tab.
  2. On the Railway card, select Connect, then approve the access in Railway. Give Squasher access to the Railway project that you want to monitor.
  3. Back in Squasher, choose the project in Railway project and select Connect project. When Railway grants access to only one project, Squasher chooses it for you.
Squasher then pulls the logs and metrics of that Railway project on a schedule. To stop, select Disconnect on the Railway card.

Send data from your service

You need a Railway service that you can redeploy, and an ingest key and the project ID. See Create an ingest key.
  1. In Railway, open the service and select Variables.
  2. Add SQUASHER_API_KEY and SQUASHER_PROJECT_ID.
  3. Connect the service with one of these options, then redeploy it.
Install @squasher-ai/node and initialize it before your app code:
src/index.ts

What Squasher keeps

To also send the plain stdout lines of a service, run a log forwarder, such as Vector, in the Railway project. Railway describes this setup in its guide to shipping logs.

Verify

  1. Throw one test error in the service, or record a span with ERROR status.
  2. In Squasher, select Issues in the sidebar. The error is at the top of the list.

Limits

  • A Railway connection pulls logs and metrics on a schedule, so they arrive a few minutes late. Send errors from inside the service for issues with stack traces.
  • RAILWAY_ENVIRONMENT_NAME is a variable that Railway sets. If your Railway environment has another name than production, automatic AI triage does not run on its issues by default.

Next steps

Node.js SDK

See every option of the Node.js SDK.

OpenTelemetry

Set up traces, logs, and metrics in any language.