Configuring Access Logs for Enhanced Traffic Monitoring.
stdout
, but logging to a file is also supported, which is recommended for high-load scenarios. However, only one logging mode—either stdout
or file—can be enabled at any given time. The logs include a predefined set of fields that help identify HTTP requests. Additionally, custom fields can be configured to capture more detailed information from the GraphQL requests.
stdout
:
GET
, POST
).
/graphql
).
/?param=1
).
User-Agent
header value provided by the client.
true
if so.
true
if so. This can better help clients filter their logs (ifrequestError: true)
to find error cases.
request.error
is present, the expression will return the error to the access logger to be printed. However if the request.error
is nil, the expression will instead will return the value of the header x-header
.
The response type of the expression is validated upon startup. You should ensure that the expression returns a value. Additionally the following are illegal return types
subgraph
attributes can be accessed in the request logger, it will always have “zero” values.subgraph
expression context object.
You can find more information about expressions and the fields accessible for expressions here.
subgraph
access logs as well, to get detailed logging of requests made to subgraphs. These logs are useful for tracing and debugging interactions between the router and its connected subgraphs. The configuration allows for custom fields to be included in the logs, providing additional context about requests and responses.
true
if so.
graphql_error_codes
graphql_error_service_names
stdout
or to a file, the logs provide flexibility with both default and custom fields to suit your specific needs.