Logstash is the bottleneck in your ELK pipeline with 100% CPU. What do you do?
AdvancedScenarioLogging Pipelines
Answer
Situation read → Heavy grok parsing and a single pipeline on JVM Logstash nodes.
What I'd do →
- Use the Logstash monitoring API (
GET _node/stats/pipelines) to find the slowest filter. - Replace grok with
dissector JSON parsing where possible; anchor grok patterns (^...$). - Increase
pipeline.workersandpipeline.batch.size, enable persistent queues. - Move parsing to the edge (structured logs from apps, or Fluent Bit/Vector parsing).
- Consider replacing Logstash with Elasticsearch ingest pipelines or Vector for lower resource use.
Why → Most Logstash CPU goes to regex; avoiding regex is the biggest win.
Interview tip → Unanchored grok patterns that fail to match are the most expensive case.
More on Logging Pipelines
Developers SSH into servers and `grep` log files to debug. You are asked to centralise logging. Where do you start?BeginnerYour app writes free-text logs like `User 42 paid 19.99 in 340ms`. Why push for structured logging, and how?BeginnerLoki ingestion is failing with `stream limit exceeded` and the ingester memory is exploding. What happened?IntermediateFluent Bit pods on busy nodes are dropping logs during traffic spikes. How do you make the pipeline lossless?IntermediateThe Elasticsearch cluster for logs goes red every Monday after the weekend batch jobs. How do you stabilise it?AdvancedFinance says the log bill doubled in a quarter. How do you cut it without losing debugging ability?Intermediate