Optimize
Losslessly compact events collected by Filebeat forwarders before they ship to output (e.g., ElasticSearch, S3). This module is a component of the Edge Optimizer app.
Architecture
graph LR
A["<div style='font-size: 14px;'>π Filebeat</div><div style='font-size: 10px;'>inputs</div>"] --> B["<div style='font-size: 14px;'>π§ Script</div><div style='font-size: 10px;'>processor</div>"]
B --> C["<div style='font-size: 14px;'>β‘ 10x Optimizer</div><div style='font-size: 10px;'>encode()</div>"]
C --> D["<div style='font-size: 14px;'>π Unix/TCP</div><div style='font-size: 10px;'>input</div>"]
D --> E["<div style='font-size: 14px;'>π€ Filebeat</div><div style='font-size: 10px;'>outputs</div>"]
classDef input fill:#2563eb,stroke:#1d4ed8,color:#ffffff,stroke-width:2px,rx:8,ry:8
classDef filter fill:#ea580c,stroke:#c2410c,color:#ffffff,stroke-width:2px,rx:8,ry:8
classDef engine fill:#7c3aed,stroke:#6d28d9,color:#ffffff,stroke-width:2px,rx:8,ry:8
classDef socket fill:#0891b2,stroke:#0e7490,color:#ffffff,stroke-width:2px,rx:8,ry:8
classDef output fill:#16a34a,stroke:#15803d,color:#ffffff,stroke-width:2px,rx:8,ry:8
class A input
class B filter
class C engine
class D socket
class E output
Data Flow
- π Filebeat Inputs - Collect logs from files, containers, or other sources
- π§ Script Processor - Intercepts events and pipes them to 10x sidecar
- β‘ 10x Optimizer - Losslessly compacts events to reduce log volume 50-80%
- π Unix/TCP Input - Receives COMPACT events back from the sidecar
- π€ Filebeat Outputs - Compact events ship to final destinations at reduced size
Key Characteristics
| Feature | Description |
|---|---|
| π¦ Lossless Compact | Compacts events to reduce log volume 50-80% |
| π Template Extraction | Repetitive structures become reusable templates |
| π° Cost Savings | Reduced storage and transfer costs |
| π§ Script Processor | Uses Filebeat's native JavaScript processor for sidecar launch |
Sidecar Relay
This module configures a Filebeat script processor and TCP/Unix input. The script processor launches a 10x sidecar process and pipes collected events to it to encode. The sidecar relays compact events back to Filebeat via the configured Unix/TCP input to ship to outputs (e.g., ElasticSearch).
Install
See the Log10x Edge Optimizer Filebeat run instructions
Deploy to k8s via Helm
See the Log10x Edge Optimizer Filebeat deployment instructions
Config Files
To configure the Filebeat optimizer module, Edit these files.
Below is the default configuration from: optimize/config.yaml.
ewogICJ0eXBlIiA6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIiA6IHsKICAgICJpbmNsdWRlIiA6IHsKICAgICAgInR5cGUiIDogImFycmF5IiwKICAgICAgIml0ZW1zIiA6IHsKICAgICAgICAidHlwZSIgOiAic3RyaW5nIgogICAgICB9CiAgICB9LAogICAgInRlbngiIDogewogICAgICAidHlwZSIgOiAic3RyaW5nIgogICAgfSwKICAgICJmaWxlYmVhdCIgOiB7CiAgICAgICJ0eXBlIiA6ICJvYmplY3QiLAogICAgICAiYWRkaXRpb25hbFByb3BlcnRpZXMiIDogZmFsc2UsCiAgICAgICJwcm9wZXJ0aWVzIiA6IHsKICAgICAgICAiZW5jb2RlT2JqZWN0cyIgOiB7CiAgICAgICAgICAidHlwZSIgOiBbCiAgICAgICAgICAgICJib29sZWFuIiwKICAgICAgICAgICAgInN0cmluZyIKICAgICAgICAgIF0sCiAgICAgICAgICAibWFya2Rvd25EZXNjcmlwdGlvbiIgOiAiQ29udHJvbHMgd2hldGhlciBldmVudHMgd3JpdHRlbiB0byBhIEZpbGViZWF0IGZvcndhcmRlciBhcmUgZW5jb2RlZCBvciB3cml0dGVuIGluIHJhdyBmb3JtXG5cblNldHMgdGhlIGZvcm1hdCBpbiB3aGljaCB0byBzZXJpYWxpemUgVGVuWE9iamVjdHMgYmFjayB0byB0aGUgRmlsZWJlYXQgZm9yd2FyZGVyLiBJZiB0cnVlLCB3cml0ZSBldmVudHMgdXNpbmcgdGhlIFtlbmNvZGVdKGh0dHBzOi8vZG9jLmxvZzEweC5jb20vYXBpL2pzLyNUZW5YT2JqZWN0K2VuY29kZSkgZnVuY3Rpb24uIElmIGZhbHNlLCB3cml0ZSBldmVudHMgaW4gdGhlaXIgb3JpZ2luYWwgZm9ybSBhcyByZWFkIGZyb20gdGhlIEZpbGViZWF0IGZvcndhcmRlciB1c2luZyB0aGUgW2Z1bGxUZXh0XShodHRwczovL2RvYy5sb2cxMHguY29tL2FwaS9qcy8jVGVuWEJhc2VPYmplY3QrZnVsbFRleHQpIGZpZWxkLiAoQWNjZXB0cyBib29sZWFuIG9yIHN0cmluZyB3aXRoICQ9IHByZWZpeCBmb3IgcnVudGltZSBldmFsdWF0aW9uKSAoRGVmYXVsdDogdHJ1ZSkiLAogICAgICAgICAgImRlZmF1bHQiIDogdHJ1ZQogICAgICAgIH0sCiAgICAgICAgIm91dHB1dEZpZWxkcyIgOiB7CiAgICAgICAgICAidHlwZSIgOiBbCiAgICAgICAgICAgICJhcnJheSIsCiAgICAgICAgICAgICJudWxsIgogICAgICAgICAgXSwKICAgICAgICAgICJtYXJrZG93bkRlc2NyaXB0aW9uIiA6ICJMaXN0IG9mIFRlblhPYmplY3QgZmllbGQgbmFtZXMgdG8gaW5jbHVkZSBhbG9uZ3NpZGUgdGhlIG1haW4gZXZlbnQgaW4gb3V0cHV0XG5cblNwZWNpZmllcyBUZW5YT2JqZWN0IGZpZWxkIG5hbWVzIHRvIGVtaXQgYWxvbmdzaWRlIHRoZSBtYWluIGV2ZW50IHRleHQgd2hlbiB3cml0aW5nIGJhY2sgdG8gdGhlIEZpbGViZWF0IGZvcndhcmRlci4gV2hlbiBlbXB0eSAoZGVmYXVsdCksIG9ubHkgdGhlIG1haW4gZXZlbnQgZmllbGQgaXMgd3JpdHRlbi4gRXhhbXBsZSBmaWVsZHM6IGxldmVsLCBncm91cCwgc3ltYm9sTWVzc2FnZS4gKERlZmF1bHQ6IFtdKSIsCiAgICAgICAgICAiaXRlbXMiIDogewogICAgICAgICAgICAidHlwZSIgOiAic3RyaW5nIgogICAgICAgICAgfSwKICAgICAgICAgICJkZWZhdWx0IiA6IFsgXQogICAgICAgIH0sCiAgICAgICAgIm91dHB1dEVuY29kZVR5cGUiIDogewogICAgICAgICAgInR5cGUiIDogWwogICAgICAgICAgICAic3RyaW5nIiwKICAgICAgICAgICAgIm51bGwiCiAgICAgICAgICBdLAogICAgICAgICAgIm1hcmtkb3duRGVzY3JpcHRpb24iIDogIk91dHB1dCBmb3JtYXQgd2hlbiBvdXRwdXRGaWVsZHMgYXJlIHNldC4gUG9zc2libGUgdmFsdWVzOiBbanNvbiwgZGVsaW1pdGVkXVxuXG5TcGVjaWZpZXMgaG93IHRoZSBjb21iaW5lZCBvdXRwdXQgKG1haW4gZXZlbnQgZmllbGQgcGx1cyBvdXRwdXRGaWVsZHMpIGlzIGVuY29kZWQgd2hlbiB3cml0aW5nIGJhY2sgdG8gdGhlIEZpbGViZWF0IGZvcndhcmRlci4gUG9zc2libGUgdmFsdWVzOiAtICoqanNvbioqOiBmb3JtYXRzIGFsbCBmaWVsZHMgYXMgYSBKU09OIG9iamVjdCAtICoqZGVsaW1pdGVkKio6IGZvcm1hdHMgZmllbGQgdmFsdWVzIHNlcGFyYXRlZCBieSB0aGUgb3V0cHV0IGRlbGltaXRlciBPbmx5IHRha2VzIGVmZmVjdCB3aGVuIGZpbGViZWF0T3V0cHV0RmllbGRzIGlzIHNldC4gKERlZmF1bHQ6IGRlbGltaXRlZCkiLAogICAgICAgICAgImRlZmF1bHQiIDogImRlbGltaXRlZCIKICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9LAogICJhZGRpdGlvbmFsUHJvcGVydGllcyIgOiBmYWxzZQp9
# πβ 'run' Filebeat optimizer configuration
# Configure an input that reads events from a Filebeat forwarder and output
# optimized TenXObjects back to Filebeat to ship to output (e.g., ElasticSearch, Splunk).
# To learn more see https://doc.log10x.com/run/input/forwarder/filebeat/optimize/
# Set the 10x pipeline to 'run'
tenx: run
# =============================== Dependencies ================================
include:
# Include optimizer output options (encodeObjects, outputFields, outputEncodeType)
- run/modules/input/forwarder/filebeat/optimize/module.yaml
# Input module to read events from Filebeat into 10x pipeline
- run/modules/input/forwarder/filebeat/input
# Output module to write encoded events from 10x pipeline into Filebeat
- run/modules/input/forwarder/filebeat/output
# ---------------------------- Filebeat Options -------------------------------
filebeat:
# 'encodeObjects' is set to true to write TenXObjects
# back to the forwarder using the encode() function field.
# To learn more see https://doc.log10x.com/api/js/#TenXObject+encode
encodeObjects: true
# 'outputFields' specifies TenXObject field names to emit alongside the encoded event.
# When set, enrichment fields are included in the sidecar output for forwarder post-processing.
# Example: outputFields: [level, group, symbolMessage]
outputFields: []
# 'outputEncodeType' controls the output format when outputFields is set.
# Possible values: 'json' or 'delimited'
outputEncodeType: delimited
Options
Specify the options below to configure the Filebeat optimizer:
| Name | Description |
|---|---|
| filebeatEncodeObjects | Controls whether events written to a Filebeat forwarder are encoded or written in raw form |
| filebeatOutputFields | List of TenXObject field names to include alongside the main event in output |
| filebeatOutputEncodeType | Output format when outputFields are set. Possible values: [json, delimited] |
filebeatEncodeObjects
Controls whether events written to a Filebeat forwarder are encoded or written in raw form.
| Type | Default |
|---|---|
| Boolean | true |
Sets the format in which to serialize TenXObjects back to the Filebeat forwarder. If true, write events using the encode function. If false, write events in their original form as read from the Filebeat forwarder using the fullText field.
filebeatOutputFields
List of TenXObject field names to include alongside the main event in output.
| Type | Default |
|---|---|
| List | [] |
Specifies TenXObject field names to emit alongside the main event text when writing back to the Filebeat forwarder. When empty (default), only the main event field is written. Example fields: level, group, symbolMessage.
filebeatOutputEncodeType
Output format when outputFields are set. Possible values: [json, delimited].
| Type | Default |
|---|---|
| String | delimited |
Specifies how the combined output (main event field plus outputFields) is encoded when writing back to the Filebeat forwarder. Possible values:
- json: formats all fields as a JSON object
- delimited: formats field values separated by the output delimiter Only takes effect when filebeatOutputFields is set.
This module is defined in optimize/module.yaml.