13 days ago
How can I retrieve the logs from the most recent build or deployment, including failed ones, onto my local machine?
Current behavior:
When I push a new commit to the GitHub repository, Railway automatically builds and deploys it. If the build or deployment fails, running railway logs locally only displays logs from the last successfully deployed (active) version, not from the failed build.
Desired behavior:
I’d like to be able to access the logs of the latest build or deployment attempt , even if it failed, directly from my local machine using the Railway CLI. This would make it easier to debug build or deployment issues without having to rely on the Railway dashboard.
2 Replies
13 days ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
12 days ago
You can fetch logs from the latest deployment attempt (including failed builds) via the CLI by upgrading to the latest Railway CLI and targeting the specific deployment ID.
Upgrade CLI: npm i -g @railway/cli, then verify with railway version. Recent releases include support for looking up failed build logs by deployment ID and improved help for the logs command.
Get the failed deployment ID: Open the service in the dashboard → Deployments tab → select the failed attempt to copy its deployment ID; build and deploy logs are visible there for confirmation.
Pull logs by deployment: Use railway logs with the deployment ID to stream the failed build/deploy logs to your terminal; this targets the latest attempt rather than only the last active deployment.
Check the following documentation:
Viewing logs guide: docs.railway.com/guides/logs.
CLI releases (notes mention using deployment ID for failed build logs): github.com/railwayapp/cli/releases.