Monitoring
Use request logs and metrics to track your services and investigate failures.
Forte captures per-request logs and metrics for Services, which are proxied through the Forte gateway. Websites are served directly and don't pass through the gateway, so Forte doesn't record a request's method, path, or status code for them. A server-rendered (SSR) website still gets runtime logs, error counts, and timing. See Monitoring a server-rendered website.
Viewing logs
Request logs
Forte captures every HTTP request to your service: the method, path, status code, and latency. Request and response body capture is on by default in Sandbox (Test) Mode projects and off by default in live projects. Change it per service in the service settings.
To view your request logs:
- Navigate to your project
- Select a service
- Click the Requests tab
The list shows all incoming requests. Forte highlights requests that returned a 5xx error so you can find failures quickly.
Click any request below to see its correlated logs: this is how the actual Forte interface works.
For each request you can inspect:
- Request & response headers and body
- All log lines written during that request (INFO, WARN, ERROR)
- Latency breakdown (total, target, integration)
- User context if the request was authenticated
How Forte correlates logs
Forte correlates logs with requests in two ways:
- More accurate, requires onboarding: A request ID included in every log line
- Default option: The timestamps of the request and log lines, matched together
If your service receives many concurrent requests, onboard to request ID correlation so logs match requests accurately. Forte provides the request ID in the X-Request-Id header and extracts request IDs from your logs when you include them in your log lines.
Log levels
Forte recognizes four log levels: ERROR, WARN, INFO, and DEBUG. Forte detects a level when it appears anywhere in the log line, as a plain word or in brackets:
# All of these are recognized
[ERROR] Failed to connect to database
INFO: Server started on port 3000
2024-01-15 DEBUG request received
WARN - retrying after timeoutForte classifies log lines without a recognized level as INFO. It also treats levels like TRACE, FATAL, and CRITICAL as INFO.
Level detection is case-insensitive, so error, Error, and ERROR are treated the same.
Request ID correlation
The examples below run inside your Forte Service: server-side code that Forte calls on behalf of your users.
Forte injects a unique request ID into every inbound request in the X-Request-Id header. For accurate log correlation, read this header and include its value in each log line you write while handling the request.
Forte recognizes these key names in your log output:
requestIdrequest_idrequest-idx-request-id
The key and value can be separated by =, :, or a space. The value must contain only letters, numbers, and hyphens.
# All of these are recognized
requestId=abc123-def456
request_id: abc123-def456
x-request-id abc123-def456
[INFO] requestId=abc123-def456 user login successfulNode.js (Express)
app.use((req, res, next) => {
req.requestId = req.headers['x-request-id'];
next();
});
// In your route handlers:
console.log(`INFO requestId=${req.requestId} processing order`);Python (Flask)
from flask import request
import logging
@app.before_request
def set_request_id():
g.request_id = request.headers.get('X-Request-Id')
# In your route handlers:
logging.info(f"requestId={g.request_id} processing order")Java (Spring Boot)
@Component
public class RequestIdFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
String requestId = request.getHeader("X-Request-Id");
MDC.put("requestId", requestId);
try {
chain.doFilter(request, response);
} finally {
MDC.remove("requestId");
}
}
}Then configure your logback pattern to include %X{requestId}:
<pattern>%d{HH:mm:ss} %-5level requestId=%X{requestId} %msg%n</pattern>Metrics
Navigate to your service's Overview tab to view:
- Request volume: Total requests over the selected time range
- Status code distribution: Breakdown by 2xx, 4xx, and 5xx responses
- Latency percentiles: P50, P90, and P99 response times
These metrics update automatically as new requests arrive.
Monitoring a server-rendered website
A server-rendered (SSR) website runs your server code for each page that the CDN can't answer from its cache. Those requests don't pass through the Forte gateway, so Forte can't record their method, path, or exact status code the way it does for a Service. It does record what your server did: each time it ran, how long it took, whether it finished, and what it logged.
Forte calls one run of your server an invocation. An invocation is a single request that reached your server. A request that the CDN answers from its cache never reaches your server, and neither does a request for a static file such as a script or an image, so neither creates an invocation.
To open these views, navigate to your project, select the website, and click the Monitoring tab.
A static website serves prebuilt files and runs no server code, so it has no runtime logs, metrics, or invocations.
Website logs
Runtime Logs shows what your server code writes to standard output and standard error, newest first. Search the text or add filters for level, time range, invocation ID, and deployment. The deployment filter uses the time the deployment was live, so lines near a handoff may come from either version.
Each line carries the ID of the invocation that wrote it, shown in the Invocation column. Click an ID to see only the lines from that invocation, together with its time, duration, and memory use. This lets you read what one request logged without lines from other requests mixed in. A line your server writes while it starts, before it handles a request, has no invocation ID.
Website metrics
Metrics opens on the last 24 hours. Choose a preset or a custom time range to inspect these readings:
- Invocations: how many requests reached your server.
- Server errors (5xx): the total number of HTTP responses with a 5xx status.
- Client errors (4xx): responses with a 4xx status, such as a 404 for a page that doesn't exist.
- Duration: how long your server spent on an invocation, at the fiftieth and ninety-ninth percentiles.
- Time to first byte: how long your server took to start sending its response.
- Peak memory: the largest share of its available memory that any single invocation used. A value close to 100% means your server is at risk of running out of memory.
The error and time-to-first-byte readings show a dash when no request reached your server in the selected range, because there is nothing to measure.
Select View invocations to inspect runs from the selected range, or select Inspect peak on the server errors card to open the hour with the most 5xx responses. Individual rows show runtime outcomes such as timeouts and crashes. The 5xx metric counts HTTP responses across the website.
Invocations
Invocations starts with the last 24 hours, newest first. Filter by time, duration, runtime outcome, or invocation ID. Click Duration to sort the entire result set by the time the server spent on each run.
Select Runtime failures to find recorded timeouts or crashes. These runs can end before your app writes an error line, so a text search can miss them. Open a row to see its details and correlated logs beside the list. For a wider view, select Open in Runtime Logs.