I Built a Java CLI to Make Kubernetes Logs Easier to Read
说明与用途
LogLens 是一个 Java CLI,通过将 JSON 日志行格式化为可读的终端视图,并提供跟踪和统计标志,简化了 Kubernetes 日志的阅读。
问题
Finding errors in Kubernetes logs is hard because logs are large, JSON‑formatted, and scattered across many lines.
结果
LogLens reduces log noise, groups similar errors, and attaches stack traces to parent errors, making debugging faster without requiring additional infrastructure.
工作流
- 1. Run kubectl logs -f pod | loglens
- 2. Use --trace
<trace_id>to filter entries for a specific request - 3. Use --stats --quiet to get a summary of error counts and recurring problems
- 4. Pipe loglens output into other terminal tools or save to a file
证据
I wanted to make that workflow a little less painful, so I built LogLens.
LogLens turns it into something more useful in a terminal: 10:24:10 ERROR Connection to 10.0.3.14:5432 timed out after 30012ms req=9f2c-a1 service=api status=500
LogLens has a --trace flag for that.
The summary includes counts by log level and source, recurring problems grouped by similar messages, and the minute when errors peaked.
LogLens supports formats including: JSON lines, logfmt, klog, Airflow logs, Python logging, Log4j-style logs, Generic timestamp and log-level formats.
- 记录日期: 2026-10-25T19:26:22.755Z