Logging
FLAT Server writes most of its logs in JSON format to the standard error output (stderr). One line is written for each event. I.e. one line each for a client request, an upstream request or an error.
For comfortable log processing, events are discriminated with the type
field that is one of
flat_access
flat_request
flat_alert
The access log can be augmented with custom fields.
All JSON log lines have a requestID
field. Its value can be used to correlate log events.
Access Log
Client requests received by FLAT are recorded as type flat_access
and have the following format:
Fields
timestamp
: Start time of the request in ISO 8601 formattype
: Event type discriminator, fixed stringflat_access
requestID
: Log Correlation ID, accessible in flows as$request/id
and$error/requestID
url
: client request URLpath
: path, query string and fragment of the client request URLstatus
: HTTP status code of the client response (number) (200
,404
,500
, …)method
: HTTP method of the client request (GET
,POST
, …)agent
:User-Agent
header of the client requestreferrer
:Referer
[sic] header of the client requestmime
:Content-Type
header of the client response (text/html
,application/json
…)realtime
: request duration in seconds (number)bytes
: uncompressed size of the outgoing response body (number)requestbytes
: uncompressed size of the incoming request body (number)flow
: filename of the applied flowrequestmime
:Content-Type
header of the client request i.e. MIME type of the incoming request bodylocation
:Location
header of the client response
Request Log
Outgoing requests to upstream APIs are recorded as type flat_request
and have the following format:
Fields
timestamp
: Start time of the request in ISO 8601 formattype
: Event type discriminator, fixed stringflat_request
requestID
: Log Correlation IDurl
: Absolute URL of the upstream request including query-stringmethod
: HTTP method of the upstream request (GET
,POST
, …)status
: HTTP status code of the upstream response (number) (0
for failed requests)mime
:Content-Type
header of the upstream response (text/html
,application/json
…)bytes
: Size of the (possibly compressed) response body in bytes (number) (0
if the body is empty; when read from the internal cache, the original response length is used)duration
: Time spent waiting for the response in seconds (number)id
: Request/Content identifier as configured with the request'sid
field orcontent
attribute (suffixed with.N
whereN
is incremented for each followed redirect starting with0
)cacheHit
: Indicating whether the response was read from FLAT's HTTP Cache (boolean) (activated with request optionuse-http-cache
)refresh
: Indicating whether the response was a304
response to a request revalidating the local cache (boolean)timing
: Contains timing information about request phasesDNS
: Time to perform name lookup inms
(number)TCP
: Time to establish a TCP connection inms
(number) (may be near zero for keep-alive requests)TTFB
: Time to first byte inms
since request was sent (number)
curlErrorCode
: cURL Error Code for failed requests (number, optional) (e.g.28
)curlErrorMessage
: Text error message of libcurl for failed requests (optional)
Error Log
Errors that have occurred during processing, such as Validation Errors are recorded as type flat_alert
.
These log events should be monitored!
Fields
timestamp
: Start time of the request in ISO 8601 formattype
: Event type discriminator, fixed stringflat_alert
requestID
: Log Correlation IDtopic
: Log topic of the alert, corresponds to debugging topicsmessage
: An informative error message
Other Log Events
In rare cases plain text log lines may be written to stdout or stderr. For example, this happens during startup.
These lines are usually error log messages of the included Apache Web server that look like this:
See also
Custom Logging (Cookbook)
log
action (Reference)get-log()
function (Reference)
Last updated