Skip to content

Compact Reducer

Ship every high-value event as full text and every low-signal event as a compact template+values tuple — without redeploying the engine.

The compact reducer makes a per-event decision whether to emit via encode() (the pattern's template hash plus extracted variable values — typically 20–40× smaller than the original line) or preserve fullText. The decision is keyed by the same field-set identity the rate reducer uses, so the same symbolMessage value a Reporter attributes cost to is the key an operator targets to reduce that cost.

Entries are declared in a CSV lookup file, typically committed to a git repo and edited by PR. The file is re-read on forwarder pod restart — so the surface area of a policy change is a diff, a review, a merge, and a rolling restart.

Lookup entry format

Standard CSV with a key,value header:

key,value
<fieldSet>,true
<fieldSet>,false
  • <fieldSet> — the joined values of compactReducerFieldNames on the event. With the default [symbolMessage] it's just the symbolMessage value (e.g. payment_retry_gateway_timeout); with [symbolMessage, container] it becomes <symbolMessage>_<container>.
  • valuetrue to compact via encode(), false to preserve fullText. Entries are deviations from compactReducerDefault.

Example (with compactReducerFieldNames: [symbolMessage] and compactReducerDefault: false):

key,value
payment_retry_gateway_timeout,true
auth_audit_trail,false

For time-bounded overrides, remove the entry via PR once no longer needed — the reducer falls back to compactReducerDefault for any unlisted field-set.

Default policy

compactReducerDefault sets the fallback decision when no entry matches:

  • false (default) — preserve fullText. Entries opt specific patterns into compaction. Right when most traffic is already high-signal.
  • true — compact via encode(). Entries opt specific patterns out of compaction (e.g. audit/compliance patterns that must stay verbose). Right when most traffic is low-signal machinery and only a few patterns need full-text fidelity.

Flipping the default is a policy decision that affects every event and requires a pod rollout. Lookup edits handle pattern-level exceptions without restart.

Reload

The lookup file is read once at pod startup. Pushing a new entry requires a rolling restart of the forwarder daemonset for it to take effect.

compactReducerLookupRetain controls the staleness warning logged at startup when the file's mtime is older than the interval (default 5m). It does not currently trigger a mid-run reload — reload-on-file-change is a planned enhancement.

Wiring

  • Set compactReducerLookupFile to the CSV path — that's the single gate that loads the module (both CompactInput and CompactObject check it in shouldLoad).
  • The forwarder output streams then branch on a single ternary field expression: encoded=shouldEncode() ? encode() : fullText. No field mutation — the decision lives in the stream expression, not on the event.
  • When compactReducerLookupFile is not set, the pre-compact path is preserved unchanged (regulate-only emits fullText; reducerOptimize=true emits encoded=encode() for every event).

Config Files

To configure the Compact reducer module, Edit these files.

Below is the default configuration from: compact/config.yaml.

Edit Online

Edit config.yaml Locally

# 🔟❎ 'run' compact reducer configuration

# Per-event compaction decision via a declarative lookup file.
# Each event is tagged with `_tenxEncode: "true"|"false"`; forwarder
# output streams branch on that field to emit encode() vs fullText.
# To learn more see https://doc.log10x.com/run/regulate/compact/

# Set the 10x pipeline to 'run'
tenx: run

# =============================== Dependencies ================================

include: run/modules/regulate/compact

# ============================ Compact Options ================================

compactReducer:

  # 'lookupFile' — path or URL to the compact-decisions file.
  # Entry format: <fieldSet>=<encode>:<untilEpochSec>[:<reason>]
  # Hot-reloaded every `lookupRetain` ms without engine restart.
  # lookupFile: /etc/tenx/compact-lookup.csv

  # 'fieldNames' — how each event's lookup key is built.
  # Matches rate reducer's default so compact + rate entries
  # address the same pattern identity.
  fieldNames:
    - $=yield TenXEnv.get("symbolMessageField")

  # 'lookupRetain' — poll interval in milliseconds.
  lookupRetain: $=parseDuration("5m")

  # 'default' — fallback when no lookup entry applies.
  #   false (default) — preserve fullText; entries opt IN to compaction
  #   true            — compact via encode(); entries opt OUT
  default: false

Options

Specify the options below to configure the Compact reducer:

Name Description
compactReducerLookupFile Path or URL to a compact decisions lookup file
compactReducerFieldNames List of TenXObject fields used to key compact lookup entries
compactReducerLookupRetain Lookup file poll interval in milliseconds
compactReducerDefault Default compaction decision when no lookup entry applies

compactReducerLookupFile

Path or URL to a compact decisions lookup file.

Type Default
String ""

Points the engine at a lookup file whose entries express per-pattern compaction decisions.

Entry format:

<fieldSet>=<encode>:<untilEpochSec>[:<reason>]

encode is true (compact via encode()) or false (preserve fullText). untilEpochSec is a Unix epoch timestamp after which the entry self-heals to compactReducerDefault.

Example (with compactReducerFieldNames: [symbolMessage]):

payment_retry_gateway_timeout=true:1745856000:OPS-5123 spike mitigation
auth_audit_trail=false:1745856000:compliance — keep verbose

Entries express deviations from compactReducerDefault. An expired entry falls back to the default exactly like a rate-reducer mute does.

The engine polls the file on the interval set by compactReducerLookupRetain — changes take effect without a restart, so this plays cleanly with a GitOps workflow where the MCP authors entries via PR.

compactReducerFieldNames

List of TenXObject fields used to key compact lookup entries.

Type Default
List [symbolMessage]

Defines the list of TenXObject field names joined with underscores to form each event's lookup key. The key format matches the rate reducer's rateReducerFieldNames, so an entry in the compact lookup targets the same pattern identity the Reporter attributes cost to.

Default: [symbolMessage] (same as the rate reducer's default).

Multi-dimensional compaction (e.g., "compact this pattern only for tenants X, Y"):

compactReducerFieldNames:
  - symbolMessage
  - tenantId

Changing this field set currently requires an engine restart — a future enhancement will allow hot-swapping via a bootstrap key inside the lookup file.

compactReducerLookupRetain

Lookup file poll interval in milliseconds.

Type Default
Number 300000

Defines how often the engine re-reads compactReducerLookupFile to pick up new/changed entries. Default of 5 minutes (300000ms) aligns with the rate reducer's rateReducerLookupRetain.

Shorter values make GitOps changes take effect faster at the cost of more file I/O. Longer values reduce I/O but delay effect.

Validation: must be at least 60000ms (1 minute).

compactReducerDefault

Default compaction decision when no lookup entry applies.

Type Default
Boolean false

Controls the fallback decision when no lookup file is loaded, no entry matches an event's field-set, or a matching entry has expired.

  • false (default) — preserve fullText. Lookup entries opt specific patterns INTO compaction.
  • true — compact via encode(). Lookup entries opt specific patterns OUT (e.g., audit/compliance patterns that must stay verbose).

Flipping this value is a policy-level decision (affects every event), not a lookup edit. Changing it requires a pod rollout. The lookup handles pattern-level overrides without restart.


This module is defined in compact/module.yaml.