Configuring Kuzzle proxy

The complete default configuration of Kuzzle proxy is stored in the proxyrc file at the root of the installation directory.

Kuzzle proxy uses rc to override its default configuration. The most common ways to do it is:

  • via a .proxyrc file (example here);
  • via environment variables prefixed with proxy_.

Logs

Kuzzle proxy uses two loggers: one is dedicated to output access logs, the second one is in charge of outputing errors.


Default configuration

By default, on a fresh installation, Kuzzle proxy outputs both access and error logs to the console.
The default format for access logs mimics Apache combined log format.

For protocols other than http, the verb is arbitrary set to DO and the url is computed based on the request controller, action and index, collection and _id if provided:

#!/bin/bash

# ::ffff:172.23.0.1 - - [24/Apr/2017:14:02:19 +0000] "DO /server/now WEBSOCKET" 200 193 - -

Custom logs configuration

Kuzzle proxy internally relies on winston popular log library.

Any option given under logs/<log type>/transport will be passed as-is to Winston related transport.

Supported transports

Kuzzle proxy supports the following transports:

Miscelaneous options

In addition to standard Winston options, Kuzzle proxy access logs accept two additional parameters:

OptionDescription
accessLogFormatAccepted values: combined (default) or logstash. If set to logstash, access logs are outputed in JSON
accessLogIpOffsetThe offset starting from the right to extract the end-user ip address from the X-Forwarded-For header. This header is set by Kuzzle proxy protocols. The default value is 0, which takes the last ip address from the header.
You may need to modify this value if Kuzzle is running behind a reverse proxy

Example - store logs to files

cat .proxyrc
{
  "logs": {
    "access": {
      "transport": "file",
      "filename": "/var/logs/kuzzle/access.log",
      "json": false
    },
    "errors": {
      "transport": "file",
      "filename": "/var/logs/kuzzle/proxy-errors.log",
      "json": false,
      "maxsize": 15728640,
      "maxFiles": 10,
      "zippedArchive": true
    },
    "accessLogFormat": "combined",
    "accessLogIPOffset": 0
  }
}