GitHub

Transform Encoder Module for Caddy's Logger

This module adds logging encoder named transform. The module accepts a template with the placeholders are surrounded by braces {} and filled by values extracted from the stucture of the JSON log encoder. The JSON configuration looks like this:

{
  "encoder": "transform",
  "template": "{...}"
}

The nesting is traversed using >. For example, to print the uri field, the traversal is templated as {request>uri} .

{
  "request": {
    "method": "GET",
    "uri": "/",
    "proto": "HTTP/2.0",
    ...
  }

The Caddyfile configuration accepts the template immediately following the encoder name, and can be ommitted to assume Apache Common Log Format. The body of the block accepts the custom placeholder property in addition to all the properties listed within the format modules section.

"log { format transform [

Read the original on github.com ↗