Measure compaction
Pulls N events from the log analyzer scoped to a service, runs them through the 10x engine, and returns per-pattern compaction ratios derived from actual byte measurements rather than hardcoded model estimates. Call this before projecting savings for a service so the projection rests on measured wire bytes, not a model default.
Example
You
measure compaction for payments-svc
Log10x
Aggregate compaction: 8.5x on 12 patterns. 11.8% of original bytes on wire. Weighted-avg per-pattern ratio: 7.9x. 9 patterns at high confidence, 3 at medium.
More to ask
- "real compaction ratio for cart-svc, last 7d"
- "sample 2000 events from checkout-svc and measure compaction"
- "what's the actual wire ratio for opentelemetry-collector"
Prerequisites
A log analyzer connector configured for the environment, and a local Log10x engine so the sampled events can run through it: either the tenx CLI (install for macOS/Linux/Windows) or a local Docker container (LOG10X_TENX_MODE=docker, auto-detected and preferred when the mode is unset).
Schema and samples
Input example
Representative call (synthetic, not captured from the live demo env).
Input schema
Agent-facing JSON Schema (the canonical shape the MCP server publishes via tools/list):
{
"type": "object",
"properties": {
"service": {
"type": "string",
"description": "Service name to scope the SIEM sample to. Used as the query filter (e.g., Datadog `service:<name>`, Splunk `sourcetype=<name>`, CloudWatch stream prefix)."
},
"sample_size": {
"type": "integer",
"minimum": 10,
"maximum": 5000,
"default": 500,
"description": "Number of events to pull from the SIEM for measurement. Default 500. Larger samples improve confidence (high confidence requires >=50 events per pattern) but take longer to pull and process."
},
"timeRange": {
"type": "string",
"pattern": "^\\d+[mhd]$",
"default": "24h",
"description": "Lookback window for the SIEM pull. Format: <N><unit> where unit is m (minutes), h (hours), or d (days). Default \"24h\"."
},
"environment": {
"type": "string",
"description": "Log10x environment id. Omit to use the default environment."
}
},
"required": [
"service"
],
"additionalProperties": false
}
Source: src/tools/measure-compaction.ts.
Output example
Representative envelope (synthetic, not captured from the live demo env). view: "summary" returns the full StructuredOutput with typed data.
Headline (the 1-line agent-facing answer):
Aggregate compaction: 8.5x on 12 pattern(s) (11.8% of original bytes on wire). Weighted-avg per-pattern ratio: 7.9x, diverges when small-volume patterns have outlier ratios.
{
"schema_version": "1.0",
"schema_epoch": "2026-05-25",
"tool": "log10x_measure_compaction",
"generated_at": "2026-06-05T12:00:00.000Z",
"view": "summary",
"summary": {
"headline": "Aggregate compaction: 8.5x on 12 pattern(s) (11.8% of original bytes on wire). Weighted-avg per-pattern ratio: 7.9x, diverges when small-volume patterns have outlier ratios.",
"bullets": [
"SIEM: Datadog, window: 24h",
"Patterns measured: 12 (9 high confidence)",
"Encoded bytes / original bytes: see must_render_verbatim table"
]
},
"data": {
"service": "payments-svc",
"sample_size_requested": 500,
"sample_size_actual": 487,
"timeRange": "24h",
"patterns": [
{
"pattern_hash": "a1b2c3d4e5f60718",
"symbol_message": "Payment charge processed",
"sample_count": 142,
"total_original_bytes": 312840,
"total_encoded_bytes": 35210,
"compaction_ratio_x": 8.9,
"confidence": "high"
},
{
"pattern_hash": "f7e6d5c4b3a29180",
"symbol_message": "Gateway timeout",
"sample_count": 64,
"total_original_bytes": 128990,
"total_encoded_bytes": 16480,
"compaction_ratio_x": 7.8,
"confidence": "high"
},
"... 10 more elided"
],
"siem_pull_ms": 2140,
"engine_ms": 410,
"must_render_verbatim": "pattern_hash | samples | orig_bytes | enc_bytes | ratio_x | confidence\n--------------------|---------|------------|-----------|---------|----------\na1b2c3d4e5f60718 | 142 | 312840 | 35210 | 8.9 | high \nf7e6d5c4b3a29180 | 64 | 128990 | 16480 | 7.8 | high ",
"aggregate_compaction_ratio_x": 8.5,
"weighted_avg_compaction_ratio_x": 7.9,
"fraction_on_wire": 0.118
},
"actions": [
{
"tool": "log10x_estimate_savings",
"args": { "service": "payments-svc" },
"reason": "Use measured compaction ratios to refine savings estimates for this service."
},
{
"tool": "log10x_pattern_detail",
"args": {},
"reason": "Drill into a specific high-ratio pattern for action options."
}
],
"truncated": false,
"warnings": []
}
Output schema
The data block inside the StructuredOutput envelope:
interface ToolData {
service: string;
sample_size_requested: number;
sample_size_actual: number;
timeRange: string;
patterns: Array<{
pattern_hash: string;
symbol_message?: string;
sample_count: number;
total_original_bytes: number;
total_encoded_bytes: number;
compaction_ratio_x: number;
confidence: 'low' | 'medium' | 'high';
}>;
siem_pull_ms: number;
engine_ms: number;
must_render_verbatim: string;
aggregate_compaction_ratio_x: number;
weighted_avg_compaction_ratio_x: number;
fraction_on_wire: number;
}
Envelope-level fields the agent should also read: summary.headline (1-line answer), actions[] (next-call chain hints as {tool, args, reason}), truncated: boolean, images[] (PNG attachments where applicable), schema_epoch (engine-ID stability boundary).