memory_limiter and batch, in the right order
A collector that runs out of memory under a traffic spike, and one that floods its backend with tiny requests. memory_limiter and batch fix one each.
- Signals
- Logs
- Category
- Reliability
- Source
- OTLP
- Components
- otlpbatchmemory_limiterotlphttp
- Destination
- OTLP/HTTP endpoint
OpenTelemetry Collector
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 25
batch:
timeout: 5s
send_batch_size: 8192
send_batch_max_size: 10000
exporters:
otlphttp:
endpoint: https://your-backend:4318
service:
pipelines:
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp]
LinkMesh
Library › Processors › Rate Limiting
- check_interval
- 1s
- limit_mib
- 512
- spike_limit_mib
- 128
What LinkMesh then pushes to the collector, under processors:
memory_limiter/route_00000506_pipe_proc_1:
check_interval: 1s
limit_mib: 512
spike_limit_mib: 128
The same, as an API call (see automation recipes):
curl -X POST "$LINKMESH/pipelines" \
-H "Authorization: Bearer $LMSAT" \
-H "Content-Type: application/json" \
-d '{
"name": "Rate Limiting",
"processors": [
{
"config": {},
"enabled": true,
"order": 1,
"templateSlug": "rate-limiting"
}
]
}'The rest of the collector config above (otlp, batch, otlphttp) is not part of this template: in LinkMesh those are separate sources, processors and destinations on the route.
Generated from LinkMesh's template catalogue by linkmesh-server snippet-render 1.470.5, not written by hand.
Download config.yamlValidated with otelcol-contrib v0.165.0 on 2026-11-30
Complete config files, each checked with the collector's own validate command (otelcol-contrib v0.165.0). Replace https://your-backend:4318 with your own OTLP endpoint before you run it.
Before and after
Example telemetry in, and what this exact config sent out when we ran it in otelcol-contrib v0.165.0. CI re-runs it on every change and fails if the output differs. Changed values are highlighted.
3 log records in, 3 log records out
Before
- body
- order 1001 accepted
- timestamp
- 2025-10-09T08:53:20.000Z
- severity
- INFO
- severity_number
- 9
- resource.service.name
- checkout
After
- body
- order 1001 accepted
- timestamp
- 2025-10-09T08:53:20.000Z
- severity
- INFO
- severity_number
- 9
- resource.service.name
- checkout
Before
- body
- order 1002 accepted
- timestamp
- 2025-10-09T08:53:21.000Z
- severity
- INFO
- severity_number
- 9
- resource.service.name
- checkout
After
- body
- order 1002 accepted
- timestamp
- 2025-10-09T08:53:21.000Z
- severity
- INFO
- severity_number
- 9
- resource.service.name
- checkout
Before
- body
- payment provider timeout
- timestamp
- 2025-10-09T08:53:22.000Z
- severity
- ERROR
- severity_number
- 17
- resource.service.name
- checkout
After
- body
- payment provider timeout
- timestamp
- 2025-10-09T08:53:22.000Z
- severity
- ERROR
- severity_number
- 17
- resource.service.name
- checkout
The gotcha
memory_limiter goes first and batch goes last. Put batch in front and the data is already held in memory by the time the limiter checks, so the limiter cannot protect anything.
Used in these pipelines
- nginx access logs to Elasticsearch, parsed into semantic conventions
- Kubernetes pod logs to Loki, enriched with deployment and cluster
- Firewall syslog to a SIEM, with PII masked
- Agents to a gateway tier, load-balanced by trace ID
- Buffer through a backend outage with a persistent queue
- Route logs to different backends by attribute (routing connector)
- Prometheus counters to a delta-only backend (cumulativetodelta)
- Windows event logs, reduced: noisy events dropped, rendered text removed
Manage this across a fleet
LinkMesh manages collector configuration across a fleet from one self-hosted control plane, so a change like this is made once rather than host by host. The first 25 Collectors are free after a no-card registration in the OpenSight Customer Portal (5 without one).
Related snippets
- Route logs to different backends by attribute (routing connector)One collector, several backends: the payments team's logs go to their store, everything else to the central one.
- Agents to a gateway tier, load-balanced by trace IDAgents route every span of a trace to the same gateway, so tail sampling on the gateways sees complete traces.
- Buffer through a backend outage with a persistent queueKeep what arrives while the backend is down on disk, and deliver it when the backend is back - even if the collector restarts in between.
- Tail a log fileShip an application log file to your backend, and keep your place in it across collector restarts.