mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 14:30:28 -05:00
Seeing what a client sent, and what Floci answered, meant reading service logs. floci.request-log.enabled (FLOCI_REQUEST_LOG_ENABLED), off by default, appends one JSON object per request and response to floci.request-log.file (./floci-requests.jsonl by default). Each line is shaped like a HAR 1.2 entry and carries callerAccessKeyId, the access key id the request was signed with, so every call can be tied to the caller that made it. The request is captured pre-matching, ahead of every other filter, so a request another filter aborts is still logged. Its body is read on the worker thread by a post-matching filter, only when its declared length is within 256 KiB, and handed back whole to the resource; a chunked body is not read, so a slow upload never holds a worker. A body that is not valid UTF-8 is stored base64, a response is cut at 256 KiB with its full size kept, and a response streamed to the client is never read. Signature, session-token, credential and cookie headers and presigned query parameters are redacted, matched by decoded name in the URL too. Lines are written by a thread of their own from a bounded queue, so a stalled file never holds a response. The file is created readable by its owner only, and only a regular file is written: a symbolic link, a named pipe or a directory at the path is refused. This is the request-log half of #4623, carried over from #4591. Refs #4623 Co-authored-by: dchakrav-github <42748809+dchakrav-github@users.noreply.github.com>