hl is a high-performance log viewer and processor designed to convert JSON and logfmt logs into a clear, human-readable output. With features like automatic pager integration, log streaming mode, and advanced filtering options, it allows swift parsing and analysis of large log files, all with minimal overhead.
hl is a high-performance log viewer and processor designed for transforming JSON and logfmt logs into a clear, human-readable format. This tool is optimized for efficiency, enabling quick parsing and analysis of large log files while maintaining minimal resource overhead.
Key Features
- Automatic Pager Integration: Seamlessly integrates with a pager for enhanced viewing convenience, defaulting to less, but supports any compatible pager.
- Log Streaming Mode: Activate log streaming with the
-Pflag, allowing real-time log updates. - Field-Based Filtering: Effortlessly filter log records by key/value pairs using the
-foption, with support for hierarchical keys. - Level Filtering: Simplify the filtering process with the
-loption for log levels. - Timestamp Range Filtering: Utilize the
--sinceand--untiloptions to filter logs by time, applying intuitive formats such as RFC-3339 or friendly shortcuts liketodayor-3h. - Field Visibility Control: Adjust visibility of specific fields using the
-hoption, along with automatic hiding of empty fields via the-eflag. - High-Speed Message Sorting: Experience lightning-fast sorting with automatic indexing via the
-sflag, enabling rapid filtering without re-scanning through logs. - Live Follow Mode: Keep logs updated in real-time using the
-Fflag, with options to preview recent messages. - Complex Query Support: Build custom queries with logical operators (AND/OR) and advanced filtering capabilities.
- Timezone Flexibility: Display timestamps in UTC or switch to local timezone as needed.
- Customization and Themes: Fully customizable through configuration files and environment variables, with support for theme switching and custom themes.
Performance Comparison
With its fast processing capabilities, hl outperforms other log processing tools on data sets of substantial sizes. For instance, processing a 2.3 GiB log file takes approximately 1.1 seconds. More details can be found in the performance comparison section within the README.
Examples of Usage
Concatenate and View Log Files
To concatenate and display all .log files in the current directory:
hl *.log
Live Log Streaming
To monitor log changes in real-time:
tail -f example.log | hl -P
Field Filtering by Key/Value
To filter messages where the component equals tsdb:
hl example.log --filter component=tsdb
Sorting Messages Chronologically
To sort log messages from all files in chronological order:
hl -s *.log
With its comprehensive feature set, hl is a valuable tool for developers and system administrators seeking to enhance their log management and analysis processes.
No comments yet.
Sign in to be the first to comment.