Skip to content

Collector

Configuration

Release: v0.1.0 (latest)

You configure the collector with environment variables only. It has 23 of them, all starting with OTHERLODE_COLLECTOR_. It reads them once, at startup. The two token files are the exception, because the collector re-reads them every 30 seconds. The collector reads the redaction secret file once, like the other settings. Any other change needs a restart.

Every invalid value stops startup. The collector writes one ERROR line to standard output, then exits with code 1. It never falls back to a default for a value you set wrongly.

For a first run, you need only an agent token. See deploy.

Rules that apply to every setting

  • An unset variable and a variable set to an empty string are the same thing. Both give the default.
  • The collector does not trim spaces unless a row below says so. A value of only spaces is therefore a value, and usually an invalid one.
  • A variable that ends in _FILE names a file inside the container. Mount the file there.
  • Boolean values use Go’s strconv.ParseBool forms, which are 1, t, T, TRUE, true, True, 0, f, F, FALSE, false and False. yes, no, on and off are invalid.
  • Duration values use Go’s syntax, such as 500ms, 30s, 5m or 1h30m. A bare number such as 10 is invalid because it has no unit. A duration must be greater than zero.
  • Integer values are plain decimal numbers with no spaces and no unit.

An invalid value logs a line like these. The msg field carries the text.

{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_FORWARD_REQUEST_TIMEOUT: time: missing unit in duration \"10\""}
{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_MAX_CONCURRENT_FORWARDS must be positive"}
{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_REDACT_ALL_LITERALS: strconv.ParseBool: parsing \"yes\": invalid syntax"}

Listening and logs

VariableDefaultAccepted valuesIf the value is invalid
OTHERLODE_COLLECTOR_ADDR:4319A host:port the collector can listen on. The host can be empty. The collector serves plain HTTP, with no TLSStartup logs the listen error after OTHERLODE_COLLECTOR_ADDR: and exits with code 1
OTHERLODE_COLLECTOR_LOG_LEVELinfodebug, info, warn or error, in any letter case. A level can take a signed offset, such as warn+1 or info-2, to set a threshold between two named levels, which sit 4 apartStartup fails. warning is invalid

The collector checks the listen address when it opens the port, after it has checked every other setting. If the port is taken or the address is malformed, it logs the failure and exits. It logs the otherlode-collector listening line only after it has opened the port.

{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_ADDR: listen tcp: address bad: missing port in address"}
{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_ADDR: listen tcp :4319: bind: address already in use"}

The collector writes logs as JSON lines to standard output. See monitoring for the log format and the metrics.

Agent authentication

These settings control which bearer tokens the collector accepts from agents. See tokens for how to rotate them.

VariableDefaultAccepted valuesIf the value is invalid
OTHERLODE_COLLECTOR_AUTH_TOKENNoneOne token, or a comma-separated list. The collector trims spaces around each tokenStartup fails if any entry is empty, including a value of only spaces. The error names the entry, such as entry 2 of 3 is empty
OTHERLODE_COLLECTOR_AUTH_TOKEN_FILENoneThe path of a file with one token per line. The collector skips blank lines and lines that start with #, after trimming spacesStartup fails if the file is missing, is not a regular file, is larger than 1 MiB, or holds no token
OTHERLODE_COLLECTOR_INSECURE_NO_AUTHfalseA boolean. true lets the collector start with no tokenStartup fails, even when a token is set

The collector needs one of the first two variables. With neither, and with OTHERLODE_COLLECTOR_INSECURE_NO_AUTH not true, startup fails.

{"time":"...","level":"ERROR","msg":"neither OTHERLODE_COLLECTOR_AUTH_TOKEN nor OTHERLODE_COLLECTOR_AUTH_TOKEN_FILE is set; refusing to start without auth (set OTHERLODE_COLLECTOR_INSECURE_NO_AUTH=1 to run unauthenticated)"}

Setting both OTHERLODE_COLLECTOR_AUTH_TOKEN and OTHERLODE_COLLECTOR_AUTH_TOKEN_FILE also fails startup, with OTHERLODE_COLLECTOR_AUTH_TOKEN and OTHERLODE_COLLECTOR_AUTH_TOKEN_FILE are both set; set one.

OTHERLODE_COLLECTOR_INSECURE_NO_AUTH takes effect only when neither token variable is set. A token or a token file always turns authentication on, whatever this variable says. A value that does not parse stops startup in either case, so a typo cannot pass for false:

{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_INSECURE_NO_AUTH: strconv.ParseBool: parsing \"yes\": invalid syntax"}

A token file the collector cannot read stops startup even when OTHERLODE_COLLECTOR_INSECURE_NO_AUTH is true. With the opt-out, the collector logs this at WARN and accepts any caller:

{"time":"...","level":"WARN","msg":"OTHERLODE_COLLECTOR_AUTH_TOKEN and OTHERLODE_COLLECTOR_AUTH_TOKEN_FILE not set; ingest endpoints are unauthenticated"}

The agent sends its token as authToken. See authToken in the agent’s configuration.

Forwarding

These settings control where the collector sends payloads and how long it waits for Otherlode’s answer. See forwarding for how the collector forwards a payload and what the agent gets back.

VariableDefaultAccepted valuesIf the value is invalid
OTHERLODE_COLLECTOR_FORWARD_URLNone, so the collector only logs payloadsAn absolute http or https URL with a host, no user info, no query and no fragment. A path is allowed. The collector removes trailing slashesStartup fails with an error that names the variable and the problem, such as OTHERLODE_COLLECTOR_FORWARD_URL: forward URL must not contain a query
OTHERLODE_COLLECTOR_FORWARD_AUTH_TOKENNoneThe key the collector sends to the forward URL. The collector trims spaces around it. It cannot hold a control characterStartup fails for a value of only spaces or a control character
OTHERLODE_COLLECTOR_FORWARD_AUTH_TOKEN_FILENoneThe path of a file that holds exactly one key. Blank lines and # lines do not countStartup fails if the file is missing, is not a regular file, is larger than 1 MiB, holds no key or more than one, or holds a control character
OTHERLODE_COLLECTOR_FORWARD_REQUEST_TIMEOUT8sA positive duration below 9s, the time budget of one request. It limits the one attempt to OtherlodeStartup fails. A value of 9s or more fails with OTHERLODE_COLLECTOR_FORWARD_REQUEST_TIMEOUT is 9s, which is not below the 9s time budget of one request; set it lower
OTHERLODE_COLLECTOR_MAX_CONCURRENT_FORWARDS32A positive integer. The most forwards in flight to Otherlode at one timeStartup fails

Without OTHERLODE_COLLECTOR_FORWARD_URL, the collector starts and logs this at WARN. The collector decodes and logs payloads, and never sends them.

{"time":"...","level":"WARN","msg":"OTHERLODE_COLLECTOR_FORWARD_URL not set; ingest payloads are only logged, not forwarded"}

The collector reads the two tuning variables only to build the forwarder. With no forward URL it still checks them, so a bad value stops startup, but they do nothing.

Two combinations fail startup on purpose.

  • A forward key variable with no forward URL. The error is OTHERLODE_COLLECTOR_FORWARD_AUTH_TOKEN or OTHERLODE_COLLECTOR_FORWARD_AUTH_TOKEN_FILE is set but OTHERLODE_COLLECTOR_FORWARD_URL is empty; set OTHERLODE_COLLECTOR_FORWARD_URL or unset the key variable.
  • Both OTHERLODE_COLLECTOR_FORWARD_AUTH_TOKEN and OTHERLODE_COLLECTOR_FORWARD_AUTH_TOKEN_FILE. The error ends with are both set; set one.

The collector makes one attempt for each payload. It retries nothing, and it keeps no queue.

If the forward URL starts with http:// and you set a forward key, the collector logs a WARN at startup, because it sends the key unencrypted.

{"time":"...","level":"WARN","msg":"forward URL uses plain http; the backend auth token is sent unencrypted","url":"http://..."}

For the Otherlode URL and key to use, see Send data to Otherlode. The collector sends the key as Authorization: Bearer <key>. A forward URL with no key sends no Authorization header.

Environment and namespace

These settings stamp one environment name and one service namespace on every payload. See environment and namespace for the effects and the mismatch counters.

VariableDefaultAccepted valuesIf the value is invalid
OTHERLODE_COLLECTOR_ENVIRONMENTNone, so the collector keeps the agent’s environmentAny text up to 1024 bytes after trimming. The collector trims spaces. A value that is empty after trimming turns stamping offStartup fails if the text is not valid UTF-8 or is over 1024 bytes
OTHERLODE_COLLECTOR_ENVIRONMENT_ACTIONinsertinsert or upsert, in any letter case. The collector trims spaces. A value that is empty after trimming counts as not setStartup fails. A set action with no environment also fails
OTHERLODE_COLLECTOR_SERVICE_NAMESPACENone, so each agent’s namespace passes throughAny text up to 1024 bytes after trimming, except . and ... The collector trims spaces. A value that is empty after trimming turns stamping offStartup fails for ., .., text that is not valid UTF-8 or text over 1024 bytes
OTHERLODE_COLLECTOR_SERVICE_NAMESPACE_ACTIONinsertinsert or upsert, in any letter case. The collector trims spaces. A value that is empty after trimming counts as not setStartup fails. A set action with no namespace also fails

insert fills in a missing value and keeps the agent’s own. upsert always writes the collector’s value.

An action variable that is set, even to insert, with a blank value variable is an error. For the environment, the error reads OTHERLODE_COLLECTOR_ENVIRONMENT_ACTION is set but OTHERLODE_COLLECTOR_ENVIRONMENT is empty; set OTHERLODE_COLLECTOR_ENVIRONMENT or unset OTHERLODE_COLLECTOR_ENVIRONMENT_ACTION. The namespace has the same error with its own names. An invalid action reads invalid action "replace": must be "insert" or "upsert".

When stamping is on, the collector logs stamping environment on ingested payloads or stamping service namespace on ingested payloads at INFO, with the value and the action.

Redaction

These settings blank string literals in branch conditions before payloads leave your network, and replace branch and site keys with keys made under a secret. See redaction for what the collector blanks and what it never changes.

VariableDefaultAccepted valuesIf the value is invalid
OTHERLODE_COLLECTOR_REDACT_BLOCKED_VALUESNoneOne regular expression per line, in Go’s RE2 syntax. The collector blanks a literal when any pattern matches part of its text. Matching is case-sensitive unless the pattern starts with (?i)Startup fails if a pattern does not compile. The error names the line, such as line 2
OTHERLODE_COLLECTOR_REDACT_ALL_LITERALSfalseA boolean. true blanks every string literalStartup fails
OTHERLODE_COLLECTOR_REDACT_SECRETNoneThe secret that keys the HMAC over branch and site keys. The collector trims spaces around itStartup fails. See the rules below
OTHERLODE_COLLECTOR_REDACT_SECRET_FILENoneThe path of a file that holds exactly one secret. Blank lines and # lines do not countStartup fails if the file is missing, is not a regular file, is larger than 1 MiB, or does not hold exactly one secret, and for the rules below

For OTHERLODE_COLLECTOR_REDACT_BLOCKED_VALUES, the collector skips lines that are empty after trimming spaces, and drops a trailing carriage return. It uses every other line as written, so leading and trailing spaces become part of the pattern. Line numbers count from 1 and include the skipped lines. A comma is part of a pattern, so each pattern goes on its own line. Patterns are not anchored, so secret matches any literal that contains secret.

{"time":"...","level":"ERROR","msg":"OTHERLODE_COLLECTOR_REDACT_BLOCKED_VALUES line 2: error parsing regexp: missing closing ]: `[`"}

You can set both blanking variables. Either one is enough to blank a literal. With neither set, blanking is off.

While blanking is on, the collector needs a secret. It replaces each branch key and site key with an HMAC of the key under that secret, so that a reader of the keys who holds no agent token cannot test a guess at a blanked literal. See replace branch and site keys. Startup fails in each of these cases:

  • Blanking is on and neither secret variable is set.
  • Both secret variables are set.
  • The secret is shorter than 32 bytes, or holds a control character.
  • The secret equals an agent token or the forward key.
  • A secret variable is set while blanking is off.

Make a secret with openssl rand -hex 32. Give every collector that sends to one Otherlode tenant the same secret, including the collector your test runs report through. The collector reads the secret once, at startup, and logs its fingerprint as secret_fingerprint. Changing the secret, or turning blanking on later, makes Otherlode treat every branch as new. Redaction explains each of these rules and lists the error messages.

Limits

These settings limit how fast each client can send and how many payloads the collector decodes at once. See limits for the numbers behind them.

VariableDefaultAccepted valuesIf the value is invalid
OTHERLODE_COLLECTOR_RATE_LIMIT_RPS5A number of requests per second per client address. 0 turns the limit off. Decimals such as 0.5 workStartup fails for text that is not a number, a negative number, inf or NaN
OTHERLODE_COLLECTOR_RATE_LIMIT_BURST20An integer. The largest spike one client can sendStartup fails for text that is not an integer. It also fails for 0 or a negative number when the rate is above 0. With the rate at 0, the collector ignores the burst
OTHERLODE_COLLECTOR_RATE_LIMIT_IPV6_PREFIX128An integer from 1 to 128. IPv6 addresses that share these leading bits share one bucketStartup fails
OTHERLODE_COLLECTOR_CLIENT_IP_HEADERNone, so the limit uses the connection’s addressA request header name, such as X-Forwarded-For. The collector reads the last entry. A request without the header, or with an empty one, falls back to the connection’s addressNo check. A name that no request carries has no effect
OTHERLODE_COLLECTOR_MAX_CONCURRENT_DECODESThe Go runtime’s GOMAXPROCS, which is the number of CPUs availableA positive integer. It caps decoding only. OTHERLODE_COLLECTOR_MAX_CONCURRENT_FORWARDS caps the forwardsStartup fails

Set OTHERLODE_COLLECTOR_CLIENT_IP_HEADER only when a proxy in front of the collector sets or appends to that header, and nothing else can reach the collector. Otherwise a client can choose its own bucket. See limits for the details. The rate limit settings do nothing when the rate is 0, including OTHERLODE_COLLECTOR_RATE_LIMIT_IPV6_PREFIX and OTHERLODE_COLLECTOR_CLIENT_IP_HEADER, but their parse rules still apply. A rate of 0 logs this at WARN.

{"time":"...","level":"WARN","msg":"rate limiting disabled; ingest endpoints accept requests unthrottled"}

Command line

The collector takes no flags. With no arguments, it serves.

CommandWhat it doesExit code
otherlode-collectorStarts the collector1 if startup fails or the server stops with an error, 0 after a clean shutdown
otherlode-collector healthcheckSends one GET /healthz to the collector’s own address and exits0 for a 200 response, 1 for anything else
Any other argument listPrints usage: otherlode-collector [healthcheck] to standard error2

The container image runs the healthcheck for you. It sets HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3. The subcommand gives up after 2 seconds.

The subcommand reads only OTHERLODE_COLLECTOR_ADDR, so it needs no token and no other setting. It probes the same port the collector listens on. If the host is empty or unspecified, such as :4319 or 0.0.0.0:4319, it connects to 127.0.0.1. An address that is not a valid host:port makes it print healthz url: ... and exit with code 1. If the collector listens on a name or IP, run the subcommand with the same OTHERLODE_COLLECTOR_ADDR value. See monitoring.

Variables the collector does not own

Some variables are not part of the collector’s own settings but change what it does.

VariableEffect
HTTPS_PROXY, HTTP_PROXY, NO_PROXYThe forwarder sends requests through the proxy these name, using Go’s standard rules. Go also reads lowercase names. NO_PROXY lists hosts that skip the proxy. A request to localhost or a loopback address never goes through a proxy. The healthcheck subcommand ignores all three, so a proxy never catches the probe. Only forwarding uses them
GOMAXPROCSSets how many CPUs the Go runtime uses. It is the default for OTHERLODE_COLLECTOR_MAX_CONCURRENT_DECODES
GOMEMLIMITA soft memory limit that the Go runtime reads. See limits

The collector reads the proxy variables once, when the forwarder first sends. Restart the collector after changing them. See forwarding.