Get Railway Logs
get-logsRetrieve build or deployment logs from Railway projects to monitor application performance, troubleshoot errors, and analyze system behavior. Supports filtering by deployment ID, service, environment, and search terms.
Instructions
Get build or deployment logs for the currently linked Railway project. This will only pull the latest successful deployment by default, so if you need to inspect a failed build, you'll need to supply a deployment ID. You can optionally specify a deployment ID, service, and environment. If no deployment ID is provided, it will get logs from the latest deployment. The 'lines' and 'filter' parameters require Railway CLI v4.9.0+. Use 'lines' to limit the number of log lines (disables streaming) and 'filter' to search logs by terms or attributes (e.g., '@level:error', 'user', '@level:warn AND rate limit'). For older CLI versions, these parameters will be ignored and logs will stream.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspacePath | Yes | The path to the workspace to get logs from | |
| logType | Yes | Type of logs to retrieve: 'build' for build logs or 'deploy' for deployment logs | |
| deploymentId | No | Deployment ID to pull logs from. Omit to pull from latest deployment | |
| service | No | Service to view logs from (defaults to linked service) | |
| environment | No | Environment to view logs from (defaults to linked environment) | |
| lines | No | Number of log lines to return (disables streaming). Requires Railway CLI v4.9.0+. Useful for searching through recent logs. | |
| filter | No | Filter logs by search terms or attributes. Requires Railway CLI v4.9.0+. Examples: 'error', '@level:error', '@level:warn AND rate limit', 'user login', '@status:500'. See https://docs.railway.com/guides/logs for more info. | |
| json | No | JSON provides structured log data with more information (e.g. timestamps) but uses more tokens. Defaults to false to save tokens. Set to true for more detailed logs. |