In a Rails request log, what do the Started, Processing by, Parameters and Completed lines each tell you about one request?
answer
- one middleware line, then controller lines
- Started: verb, filtered path, remote IP
- Processing by Class#action as FORMAT
- Completed: status, ms, Views, ActiveRecord, GC
- Filter chain halted
basics
~20 sStarted gives the verb, path, client IP and time. Processing by names the controller, action and format, and Parameters shows the filtered params. Completed gives the status and total milliseconds, split into Views, ActiveRecord with query counts, and GC.
solid answer
~40 s`Started POST "/checkouts" for 203.0.113.9 at ...` is written by the `Rails::Rack::Logger` middleware before routing. It shows the verb, the path with sensitive query params filtered, and `request.remote_ip`. `Processing by CheckoutsController#create as HTML` tells you which action the router picked and the format. `Parameters:` follows with the filtered params. The last line is the timing summary: `Completed 302 Found in 2104ms (ActiveRecord: 1950.2ms (38 queries, 4 cached) | GC: 3.1ms)`. It splits the action's time into views, database and garbage collection, and `Views:` appears only when something rendered. In between, `Redirected to`, `Filter chain halted as ... rendered or redirected` or `Rendered` lines show what happened along the way. For a slow request, compare the components with the total first.
go deeper
Recall what each of the four lines contains and which line names the controller action and the response status.
Explain which component writes each line, when the Views and ActiveRecord segments appear, and what Filter chain halted means.
Use the Completed breakdown to decide whether a slow request is database, rendering, Ruby work or time outside the controller, before opening a profiler.
Decide which request facts must reach the logs for on-call diagnosis and where per-request timing belongs instead, in logs, metrics or traces.
## The shape of one request in the log Each request Rails serves leaves a predictable block of lines. Different parts of the framework write them, and knowing which part wrote which line tells you how far the request got. Here is a slow checkout in an electronics store, logged at info: ``` Started POST "/checkouts" for 203.0.113.9 at 2026-10-06 14:02:11 +0000 Processing by CheckoutsController#create as HTML Parameters: {"authenticity_token" => "[FILTERED]", "order" => {"shipping_method" => "express", "cvv" => "[FILTERED]"}} Redirected to https://shop.example/orders/5512 Completed 302 Found in 2104ms (ActiveRecord: 1950.2ms (38 queries, 4 cached) | GC: 3.1ms) ``` ## Line by line 1. **`Started`.** The `Rails::Rack::Logger` middleware logs it before the router runs. It carries the raw HTTP verb, `request.filtered_path` (the path, with any query parameters matching `filter_parameters` masked), `request.remote_ip`, and a timestamp. A `Started` line with no `Processing by` after it means the request never reached a controller: middleware answered it, or no route matched. 2. **`Processing by`.** Action Controller logs it when the action starts: the controller class, the action, and the format, such as `HTML`, `JSON` or `TURBO_STREAM`, or `*/*` when none was negotiated. This line answers which route matched. 3. **`Parameters:`.** The params hash after `config.filter_parameters` has run, minus internal keys such as `controller`, `action` and `format`. It is omitted when there are no params. 4. **Lines in the middle.** These come from the action itself. `Redirected to <url>` comes from `redirect_to`, and `Rendered layout ...` from Action View. `Filter chain halted as :require_authentication rendered or redirected` means a `before_action` responded, so the action body never ran. `rescue_from handled ...` means a handler caught an exception. 5. **`Completed`.** Logged at the end of the action: status code and phrase, the action's total time, then the parts in parentheses. ## Reading the Completed line | Segment | Meaning | Present when | |---|---|---| | `in 2104ms` | Time inside the controller action, callbacks included | Always | | `Views: 41.3ms` | Time spent rendering templates and partials | Something rendered | | `ActiveRecord: 1950.2ms (38 queries, 4 cached)` | Database time, statement count, and how many came from the query cache | Active Record is loaded | | `GC: 3.1ms` | Garbage-collection time during the action | Always | In the example, 1950 of 2104 ms went to the database across 38 statements. So you look at queries before you look at templates, and there is no `Views:` segment because the action redirected. A total far above the sum of the segments points at Ruby work in the action itself, or at time waiting on something outside Rails, such as an HTTP call to the payment gateway. The `Completed` time covers the controller action only. Time spent in middleware, or waiting in the web server's queue, falls between the client's view of the request and this number. So a request that feels slow to the user but shows a small `Completed` time is slow somewhere before the controller. ## A worked diagnosis Take the slow checkout above and read it as an on-call engineer would: 1. **Confirm the route.** `Processing by CheckoutsController#create as HTML` shows the request reached the expected action, so routing and middleware are not the story. 2. **Check the outcome.** `Completed 302 Found` and `Redirected to .../orders/5512` mean the action finished with a redirect to the new order. It was slow, not broken. 3. **Split the time.** ActiveRecord accounts for 1950 of 2104 ms, so the action spent most of its life waiting on the database. 4. **Count the statements.** Thirty-eight queries for one order often means one lookup per line item. The next step is the debug-level SQL lines, or the query tags that point each statement back to its source. 5. **Note what is absent.** No `Views:` segment and only 3 ms of GC rule out rendering and memory pressure for this request. ## Pitfalls when reading request logs - **Interleaving.** Puma serves several requests on threads at once, so their lines mix in one stream. Without a tag such as the request id on every line, you cannot reliably say which `Completed` belongs to which `Started`. - **The level.** At info you see these lines but not the SQL statements behind the ActiveRecord total. Those are debug-level. - **Health checks.** The generated production config sets `config.silence_healthcheck_path = "/up"`, so load-balancer probes do not bury real traffic. - **Exceptions.** An unhandled exception still produces a `Completed` line with the status that exception maps to, such as `500 Internal Server Error` or `404 Not Found`, and the error and backtrace are logged separately. ## Takeaway Read the block from top to bottom. `Started` and `Processing by` tell you where the request went, `Parameters` what it carried, the middle lines what the action did, and `Completed` where the time went.
- A log shows a Started line and a Processing by line, then Filter chain halted as :require_authentication rendered or redirected. What happened?A `before_action` named `require_authentication` called `render` or `redirect_to`, so Rails halted the callback chain and the action body never ran. The usual cause is the authentication generator's concern sending an unauthenticated visitor to the sign-in page. The `Completed` line that follows shows the status that callback produced, typically `302 Found`.
- Why does a Completed line for a redirect often have no Views segment?Action Controller adds `Views:` only when `render` ran during the action and set the view runtime. `redirect_to` renders no template, so the segment is missing and the line shows only `ActiveRecord:` and `GC:`. It is not a logging fault.
- The Completed time includes time spent in middleware before routing.
- A missing Views segment means template rendering was not logged at info.
- The Started line is written by the controller after routing succeeds.
- The Parameters line shows the raw params, so card fields appear in clear text.
- Filter chain halted means an exception was raised inside a before_action.