railway metrics
View resource and HTTP metrics for a Railway service from the CLI. The
metrics command works at three levels: the linked service by default, a
specific service with --service, and every service in the project with
--all.
You can also call the command as railway metric. Both forms behave
identically.
Usage
railway metrics [OPTIONS]Options
| Flag | Description |
|---|---|
-s, --service <SERVICE> | Service to view metrics for. Defaults to the linked service. Conflicts with --all. |
-a, --all | Show metrics for all services in the project. Conflicts with --raw. |
-e, --environment <ENV> | Environment to view metrics for. Defaults to the linked environment. |
-S, --since <TIME> | Start of the time window. Accepts relative (1h, 6h, 1d, 7d) or ISO 8601. Defaults to 1h. |
-U, --until <TIME> | End of the time window. Same formats as --since. Defaults to now. Conflicts with --watch. |
--cpu | Show only CPU metrics. |
--memory | Show only memory metrics. |
--network | Show only public network traffic (egress and ingress). |
--volume | Show only volume and disk metrics. |
--http | Show only HTTP metrics. |
--method <METHOD> | Filter HTTP metrics by request method. Requires --http. |
--path <PATH> | Filter HTTP metrics by request path. Requires --http. |
--raw | Output raw time-series data points instead of summaries. |
--json | Output in JSON format. |
-w, --watch | Open a live TUI dashboard that refreshes metrics. |
Metric groups
When no metric flag is set, railway metrics shows every group. Pass one or
more flags to limit output:
--cpu: CPU usage and limits.--memory: Memory usage and limits.--network: Public network ingress and egress.--volume: Disk and volume usage.--http: HTTP request totals, status-code buckets, error rate, and latency percentiles.
For database services, the command detects supported database images and includes native database stats from Postgres, Redis, MySQL, and MongoDB through Railway SSH.
Examples
Quick overview of the linked service
railway metricsSpecific service and environment
railway metrics --service my-api --environment productionLast 6 hours
railway metrics --since 6hSpecific time window
railway metrics --since 1d --until 1hOnly CPU and memory
railway metrics --cpu --memoryOnly HTTP metrics
railway metrics --httpHTTP metrics for POST requests to a specific path
railway metrics --http --method POST --path /api/usersRaw time-series data
railway metrics --raw --cpuCompact view across every service in the project
railway metrics --allJSON output for scripts and agents
railway metrics --jsonrailway metrics --json --http --method POSTLive dashboard
railway metrics --watchrailway metrics --all --watchThe --watch mode opens an interactive TUI with periodic refreshes,
time-range switching, metric toggles, HTTP status and latency series toggles,
and per-service detail panels in project mode.