Read request logs
Before you begin
- Role
- Viewer or higher.
The request logs show each request a project received, what answered it and what went back, so you can see exactly what a client sent. What a log can hold, and the settings that decide it, are in Your data in MockHub.
-
Open the project’s Request logs tab.
-
Select Filters. Closed again, it counts the filters in force, such as Filters (2).
-
To see one method only, open Any method and choose it, such as
POST. -
To see one kind of answer only, open Any outcome and choose it:
Choice Shows the requests A mock answered that one of the project’s mocks matched No mock matched that reached the mocks and matched none of them Forwarded to your upstream that the project sent on to its upstream: the captures Webhook inbox sent to /__inboxor a path below it -
To change the order, open Newest first and choose Oldest first, URL (A–Z) or Unmatched first.
-
Select Request and response on a row to see the request and the response, each with its headers and body. Each Body has a Copy button.
To find requests by address, type part of it into Search URL, such as orders/88. The list shows the requests whose URL contains it anywhere, the query string included, whatever the case. The search starts once you stop typing.
To see one period, set From and To under Filters. Each opens a calendar with the time below it, in your browser’s time zone on a 24-hour clock, and the list changes when the calendar closes. From includes the minute you choose and To stops just before its minute; either can be left empty. From goes back no further than the plan keeps logs. Under the calendar of From, Last 15 minutes, Last hour and Last 24 hours set the start and clear To.
To see only the requests a running chaos profile shaped, open With or without chaos under Filters and choose Caused by chaos. Not caused by chaos shows every other request.
Any outcome also offers Mock server did not answer: requests the project’s mock server gave no answer to, because it could not be reached or a chaos profile cut the connection. Whether a mock would have matched is unknown, so they are kept apart from No mock matched, and a row shows the same words under Answered by.
Clear filters removes every filter at once. The filters, the order and the page are part of the page’s address, so a copied link opens the same view.
What a row shows
Section titled “What a row shows”| Column | Shows |
|---|---|
| When | When the request arrived, in your browser’s time zone: the time alone for today’s requests, the day and time for older ones. Hover over it for the full date and time |
| Method | The request’s method |
| URL | The path and query string. An HTTP tag marks a request that arrived over unencrypted HTTP |
| Status | The status code that went back |
| Duration | How long the answer took, such as 42 ms, or a dash when it was not recorded |
| Answered by | The name of the mock that answered, linked to it, or No mock matched, Forwarded to your upstream (with via and the scheme, host and port it went to, when that was recorded) or Webhook inbox |
A tag beside the status says what a chaos profile did to the request: Injected error for its error injection, Connection cut for a connection fault, and Delayed for its added delay. These requests count in no insights figure and no alert rule. Upstream unreachable marks a 502 MockHub answered itself because it could not reach the project’s upstream.
On a phone, the time, the duration and what answered sit under the URL. The open exchange ends with how long the answer took, such as “Answered in 42 ms”. It is measured across the whole trip through MockHub, including any delay the mock adds; when there was one, it says how much, such as “Answered in 1520 ms, including the mock’s 1500 ms delay”. A request to a mock with a delay can appear in the list while its caller is still waiting out the delay.
When logging changed the response before storing it, tags above it say how: Response not stored while Log response headers and body is off, Body cut short of the size that was sent when the body was longer than the plan keeps, Body fields redacted when a captured JSON body had fields hidden, Redacted with the headers whose values were hidden, and Headers cut short when the headers ran past 64 KiB. Logs written before MockHub recorded this have no tags.
When the mock’s template could not be rendered, the caller got a Mock response did not render error, which the exchange shows as the response. Above it, The mock’s response did not render says why in plain words, and Open the mock opens the mock in the editor, where Try it marks the expression at fault. A project that does not log request or response data keeps no reason, and the exchange says so.
To have the assistant propose the fix, select Fix with AI in that note. It reads the request and why its response did not render, and MockHub sends the request to the fixed mock in the sandbox before you review the proposal. It needs the Editor role and a plan with the assistant.
On a plan that includes OpenAPI and a project with a contract, Check against the contract on a row a mock or your upstream answered checks its response against the contract; see Check a request log against the contract.
Check this range, under More actions on these logs beside the order, checks the responses of every log the list’s period and filters match, at most 500, and ticking rows offers Check 2 against the contract for those rows; see Check request logs in bulk.
One mock’s requests
Section titled “One mock’s requests”On the project’s Mocks tab, the Logs column shows how many logged requests each mock answered. Select the number to open the same screen limited to that mock, which names it, such as “Requests answered by List users.” For a mock with several responses or a response sequence, it includes the requests every one of them answered.
Open this mock opens it in the editor, and Every request in this project returns to the whole project’s logs. Any outcome is not offered here, because every row is that mock answering.
Why this response
Section titled “Why this response”A mock can hold several response variants, so a row that a mock answered says which of them did. Open the row with Request and response and read Why this response?:
| Line | Says |
|---|---|
| Matched mock | The mock, linked, with the version it had when it answered |
| Response | The response’s name, and its key when the key says more than the name |
| Selected by | The mock’s default, as no override or rule chose another, X-MockHub-Response header, Rule 2, the first whose conditions held with the number of the rule (A rule when the number was not recorded), or Sequence, step 2 with the step’s own number (Sequence when the step was not recorded) |
This is what was recorded when the request was served. Renaming, editing or deleting the response later does not change it. Open this response opens the mock in the editor on that response, and says so there if the key no longer exists. A request logged before MockHub recorded this, or one whose mock was served another way, reads Not recorded for this request. and does not show the mock’s default today, which may not be what answered.
A request that asked for a response with X-MockHub-Response and was refused is a row under Mock server did not answer, with a 422 and nothing that answered it. The refusal is retained even when Log response headers and body is off. Check matching explains it:
- Recorded when served holds what the log itself knows: MockHub refused the named response. It records no reason, because the refusal is the same whatever the cause.
- Checked against current configuration holds what the named mock says now: that it is gone, inactive, answers with a sequence, has overrides turned off, has no such response, or does not take the request. Anything the log could not keep, such as a header the project does not log, is tagged Limitation.
The check sends nothing to your project and changes nothing; see A response you asked for was refused.
Test a logged request against today’s mocks
Section titled “Test a logged request against today’s mocks”A log says what answered when the request came. To see what would answer it now, after you have changed a mock, test it again:
-
Open the row with Request and response.
-
Under Request, select Test against current mocks. The Test a request page opens with the request filled in: its method, its path and query string, its headers and its body.
-
Change anything you want to, such as a header the log did not keep.
-
Select Test request.
Recorded when served shows what the log recorded, such as “Answered by “Get orders” (version 3) with “Order list”, status 200.”, and the result below it starts with Now:, so the two answers sit side by side. Open the original log returns you to the row, opened. If the log is no longer kept, the page says so and the request starts empty. What the result says is in Test a request against the project.
Only what logging kept is filled in, and the page lists what it could not fill under The log did not keep the whole request: a header whose value was redacted, in whole or in part, such as an Authorization header logged as Bearer [REDACTED] or a Cookie header logged as session=[REDACTED], which is left out rather than sent with the placeholder; a header list or a body that was cut short, a body with redacted fields, which is sent as it was logged, a HEAD request’s method, and, when the project does not log request data, the headers and body altogether. Enter a value to send it. The page’s address names only the log, never the request it carried.
Live updates
Section titled “Live updates”While you look at the newest requests, new ones appear by themselves a moment after they are answered. A tag in the list’s toolbar says what it is doing:
| Tag | What it means |
|---|---|
| Live | You are on the first page, sorted Newest first, with no row checked and no exchange open. New requests are added as they arrive, filters and the one-mock view included. |
| Paused | Any other view: another page or order, a checked row or an open exchange, which the words beside the tag name, such as “while a row is open”. The rows stay where they are, and New requests appears when more arrive. Select it to return to the newest page. Refresh reads the page again. |
| Reconnecting… | The connection dropped. The screen reconnects by itself, waiting longer after each failed attempt up to 30 seconds, and reads the newest page again once it is back. |
| No tag | Live updates are not available here. The list changes only when you select Refresh, a filter or another page. |
Refresh shows only while the tag is not Live, since a live list reads new requests by itself. While paused, the button counts what arrived and matches your filters, such as 3 new requests.
A period with a To is always Paused, and New requests does not appear: nothing that arrives now can fall inside it.
Live updates stop while the browser tab is hidden, and start again with a fresh read when you return to it.
Result
Section titled “Result”The list shows the requests that match your filters, 15 to a page; when there is more than one page, you can choose 30 or 60. The question mark beside the Request logs heading says how long the workspace’s plan keeps request logs. The limits page lists each plan’s period.
Limits
Section titled “Limits”- A request no mock matched is logged only while Log requests no mock answered is on in the project’s settings, as it is for a new project. See Find requests no mock matched.
- A connection a chaos profile fails on purpose shows as a
502under Mock server did not answer, tagged Connection cut. MockHub sees only that the connection failed, so while a profile with connection faults runs and covers the path, it tags every failed connection, including one to a mock server that could not be reached. - Requests logged before MockHub tagged chaos carry no tag.
- Nothing new is logged while Store request logs is off. A request refused before it reached the project, such as a
429over a rate limit or a402from a suspended workspace, is never logged, and neither is a request to a hostname no project owns. - Logs older than the plan keeps are removed, and so are the oldest logs when the workspace reaches its log row or storage limit; see How long it is kept.
- With a filter set, the count stops at 10,000 and reads “10,000+ matching requests” when more match. The list pages through the first 10,000 of them; narrow the filter, or set From and To, to reach the rest.
- A browser’s preflight that MockHub answered itself is not logged, and a logged response does not show the CORS headers MockHub added to it; see Let web pages call a project.