Skip to main content

Module file_logger

Module file_logger 

Source
Expand description

The file-logger node — appends per-request access-log entries as newline-delimited JSON to a local file, mirroring APISIX’s file-logger plugin.

Entries are built with the shared build_entry helper and handed to a BatchSink; a background task opens the target file in append mode per flush and writes each entry as one JSON line. Writing is fire-and-forget on the request path — Plugin::execute pushes the entry and returns the context unchanged — so place this node in the response pipeline after the upstream node.

§Deviations from APISIX

  • APISIX writes each request immediately; featherbit routes writes through the shared BatchSink for consistency with the other loggers. Set batch_max_size: 1 to write every entry as it arrives.
  • The parent directory is not created: if it is missing the flush fails (logged and, per BatchConfig, retried/dropped). The file itself is created if absent.

Structs§

FileFlusher 🔒
BatchFlusher that appends the batch to path.
FileLoggerPlugin
The file-logger plugin node.

Functions§

entries_to_lines 🔒
Serializes each entry as one line of JSON, newline-terminated. Pure and I/O-independent for unit testing.