TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Lightweight log viewer with Python-powered filtering and formatting

3 点作者 dloss5 个月前
I&#x27;d like to share &quot;klp&quot;, a command-line log viewer for investigating small to medium-sized log files (up to ~100k lines). While there are faster and more mature log viewers out there, I think klp has some features that might be interesting:<p>- Visualize log level patterns with --levelmap showing the density of different log levels over time (e.g., IIIWWEEE for a sequence of INFO, WARNING, ERROR)<p>- Visual separation of time gaps with --mark-gaps INTERVAL (e.g., 1h) to spot suspicious quiet periods<p>- Condense bursts of events with --fuse INTERVAL (e.g., 1h) to highlight when activity starts and ends<p>- Built-in regexes for common patterns (URLs, IPs, file paths, email addresses, common error messages, and many others)<p>- Python expressions for complex filtering: --where &quot;int(status) &gt;= 500 and &#x27;timeout&#x27; in message.lower()&quot;<p>- Built-in support for logfmt, JSON Lines, CSV, SQLite and others, plus ability to write ad-hoc parsers in Python on the command line<p>- Custom output formatting using Python code and templates<p>klp is a single Python file with no dependencies beyond Python 3.7+. Install with <i>pip install klp-logviewer</i> or download the file from GitHub:<p>&lt;<a href="https:&#x2F;&#x2F;github.com&#x2F;dloss&#x2F;klp">https:&#x2F;&#x2F;github.com&#x2F;dloss&#x2F;klp</a>&gt;<p>I originally built this for my own debugging needs at work where I couldn&#x27;t install other tools. When my employer allowed me to open-source it (MIT license), I added more features to explore ideas I hadn&#x27;t seen in other log tools.<p>Since I&#x27;m just a single developer maintaining this in my spare time, I&#x27;ve included a carefully curated list of more robust alternatives in the README.<p>I welcome your feedback on klp and its features, and would be delighted if these ideas inspire other log tools - especially approaches like visual time gaps, fusing events and log level maps.

暂无评论

暂无评论