---
title: RailQL
description: Learn RailQL by turning HTTP request events into a chart, then explore the language, data sources, and observability workflows.
---
RailQL is the query language for observability on Railway. It reads metrics, logs, HTTP requests, DNS lookups, network flows, trace spans, and traces. Queries return individual events or time series that you can chart.

<Banner variant="primary">RailQL is available through <a href="/platform/priority-boarding">Priority Boarding</a>. Breaking changes may occur.</Banner>

## Quickstart

This quickstart guides you through building a query to chart failed HTTP requests over time, one step at a time. These examples use a service named `api`; replace it with your service name. HTTP events are collected at Railway's edge, so are only available for requests over the public internet.

To execute a RailQL query and view its result:

1. Navigate to your project's **Observability** tab.
2. Select a time range with HTTP traffic.
3. Enter a query in the query bar and click **Run**, or press Ctrl/Cmd+Enter.

Reading HTTP events requires the Member role in the project. If a query returns no events, widen the range or remove the status filter to check whether requests were recorded.

### Read individual requests

Start with the HTTP [event source](/observability/railql/data-sources#sources), filtered to your service:

```railql
http{service=api}
```

`http` selects the HTTP request source. The braces contain a [filter](/observability/railql/language-reference#filters): `service=api` keeps requests for the service named `api`. The [`=` operator](/observability/railql/language-reference#operators) matches a value exactly.

The result is an [event stream](/observability/railql/how-it-works#series-and-event-streams), displayed as a table with one row per matching request in the selected time range. Each row includes the request's path, status, duration, and other details. Click a row to inspect it.

For example, the table might include these rows. These are illustrative requests; your results depend on your service's traffic.

| Time | Path | Status | Duration |
|---|---|---|---|
| 12:01:42 | `/checkout` | 503 | 240 ms |
| 12:01:18 | `/cart` | 500 | 85 ms |
| 12:01:05 | `/checkout` | 200 | 120 ms |

### Keep failed requests

Add a status filter inside the braces. [Filter terms next to each other](/observability/railql/language-reference#combine-terms) must both match (AND).

```railql
http{service=api http_status>=500}
```

`http_status>=500` keeps requests whose status code is at least 500, such as 500 or 503. Combined with `service=api`, it selects failed requests for that service.

The result is still a table of individual requests with the same columns. Filtering changes which rows appear; it doesn't combine them or calculate a count.

### Count failures over time

Add [`rollup count`](/observability/railql/language-reference#event-rollups) to turn the events into a series:

```railql
http{service=api http_status>=500} rollup count
```

`rollup` aggregates the events over time, and `count` chooses what to calculate: the number of matching requests. RailQL divides the selected range into [time steps](/observability/railql/how-it-works#steps-and-the-query-range) and counts the failures in each one. The step size is chosen automatically from the range.

The result is one [time series](/observability/railql/how-it-works#series-and-event-streams), displayed as a chart. Each point contains the total failures across all paths during that step. For example, a one-minute step containing 120 failed requests has a value of `120`.

### Split the count by endpoint

Add `by path` to produce one series for each request path:

```railql
http{service=api http_status>=500} rollup count by path
```

`by path` tells the rollup to count each distinct path separately within every step. If those 120 failures include 90 requests to `/checkout` and 30 to `/cart`, the step now has two counts: `90` and `30`.

The result contains one time series per matching path. Each series has a `path` [label](/observability/railql/how-it-works#labels), such as `path=/checkout`, which identifies it in the chart's legend. The grouping stays the same across time steps, so you can follow each path's failures over time.

Paths containing IDs can produce many series. If you reach the [series limit](/observability/railql/errors-and-limits#reduce-cardinality), narrow the filter to the paths you want to investigate, keeping `by path` to compare them.

### Convert counts to a rate

Append `| rate` to express each count as requests per second:

```railql
http{service=api http_status>=500} rollup count by path | rate
```

The pipe (`|`) passes the rollup's series into a [stage](/observability/railql/language-reference#stages) that transforms them. `rate` divides each count by the step's duration in seconds. For the one-minute step above, `/checkout` becomes `90 / 60 = 1.5` requests per second, and `/cart` becomes `30 / 60 = 0.5`.

The result still has one series per path, with the same labels. Its values now measure requests per second instead of requests per step, making rates easier to compare when changing the time range also changes the step size.

The chart below shows an illustrative result with one-minute steps. At 12:01, the 90 failed requests to `/checkout` become 1.5 requests per second, and the 30 to `/cart` become 0.5 requests per second.

<RailqlDiagram type="quickstart-result" />

The query has transformed individual requests into a rate for each path:

<RailqlDiagram type="pipeline" />

From the RailQL explorer view, click **Add to dashboard** to save the query as a panel. See [Explorer and dashboards](/observability/railql/explorer-and-dashboards) for visualizations and panel settings.

## Where RailQL is available

The same language works in the explorer, dashboard panels, the Railway Agent, and assistants connected to the [Railway MCP server](/ai/mcp-server). The selected environment and time range provide the context around the query.

### Agents and MCP

The Railway Agent can run RailQL queries and display charts in chat. Assistants connected through the [Railway MCP server](/ai/mcp-server) can investigate observability data and create or update dashboard panels from natural-language requests, such as:

- "Why did the error rate of the api service increase in the last hour?"
- "Which endpoints of the api service are the slowest today?"
- "Add a dashboard panel showing each service's memory usage as a percentage of its limit."

Running queries through MCP requires the Member role in the project. Connection instructions are in the [MCP server documentation](/ai/mcp-server).

## Continue learning

Choose a page based on what you need to do next.

[How RailQL works](/observability/railql/how-it-works): Understand events, series, time, aggregation, and transformations.

[Language reference](/observability/railql/language-reference): Look up filters, rollups, stages, windows, arithmetic, and units.

[Explorer and dashboards](/observability/railql/explorer-and-dashboards): Run queries, choose visualizations, and save panels.

[Cookbook](/observability/railql/cookbook): Copy practical queries or follow an investigation from a chart to events.

[Errors and limits](/observability/railql/errors-and-limits): Diagnose unexpected results and missing data, resolve errors, and check operational limits.

[Data sources](/observability/railql/data-sources): Find metrics, event fields, labels, and retention.

## See also

- [Logs](/observability/logs) - view, filter, and export build, deploy, and runtime logs.
- [Metrics](/observability/metrics) - inspect CPU, memory, disk, and network usage per service.
- [Tracing](/observability/tracing) - instrument your services and follow requests through them.
- [MCP server](/ai/mcp-server) - query Railway from your AI assistant.