RailwayDocs

railway logs

View build or deploy logs from a Railway deployment. Streams logs by default, or fetches historical logs when using --lines, --since, or --until flags.

Usage

Options

FlagDescription
-s, --service <SERVICE>Service to view logs from (defaults to linked service)
-e, --environment <ENV>Environment to view logs from (defaults to linked environment)
-d, --deploymentShow deployment logs
-b, --buildShow build logs
-n, --lines <N>Number of log lines to fetch (disables streaming)
-f, --filter <QUERY>Filter logs using Railway's query syntax
--latestShow logs from latest deployment (even if failed/building)
-S, --since <TIME>Show logs since a specific time (disables streaming)
-U, --until <TIME>Show logs until a specific time (disables streaming)
--jsonOutput logs in JSON format

Examples

Stream live logs

View build logs

View last 100 lines

View logs from last hour

View logs from time range

View logs since specific time

Filter error logs

Filter warning logs with text

Logs from specific service

Logs from specific deployment

JSON output

Time formats

The --since and --until flags accept:

  • Relative times: 30s, 5m, 2h, 1d, 1w
  • ISO 8601 timestamps: 2024-01-15T10:30:00Z

Filter syntax

Railway uses a query syntax for filtering logs:

  • Text search: "error message" or user signup
  • Attribute filters: @level:error, @level:warn
  • Operators: AND, OR, - (not)

See Logs for full syntax documentation.

Behavior

  • Stream mode (default): Connects via WebSocket and streams logs in real-time
  • Fetch mode: Retrieves historical logs when using --lines, --since, or --until
  • If the latest deployment failed, build logs are shown by default