Access Log Template

Renders a configurable text line for each request

Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.

Category: Practical
Task: Renders a configurable text line for each request

Prerequisites: The product runtime and any backend services referenced by this configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# Access Log Template
#
# Renders a configurable text line for each request. The rendered string is
# logged as the `line` field of the `access` event; `PRAXIS_LOG_FORMAT` still
# decides whether the subscriber writes that event as text or JSON, exactly as
# it does for the default and `fields` shapes. Template tokens use the same
# names as the `fields` tokens, wrapped in braces: {method}, {path}, {status},
# {duration_ms}, {request_id}, {client_ip}, and so on.
#
# Usage:
#   cargo run -p praxis-proxy -- -c examples/configs/observability/access-log-template.yaml
#   curl http://localhost:8080/

listeners:
  - name: default
    address: "127.0.0.1:8080"
    filter_chains:
      - main

filter_chains:
  - name: main
    filters:
      - filter: request_id

      - filter: access_log
        template: '{method} {path} {status} {duration_ms}ms id={request_id}'

      - filter: router
        routes:
          - path_prefix: "/"
            cluster: backend

      - filter: load_balancer
        clusters:
          - name: backend
            endpoints:
              - "127.0.0.1:3000"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends