Linux command
hl 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
View JSON logs
hl [path/to/logfile.json]
Filter logs by level
hl -l [error] [path/to/logfile]
Filter by field value
hl -f [key]=[value] [path/to/logfile]
Stream logs
hl -P [path/to/logfile]
Filter by time range
hl --since "[2024-01-01]" --until "[2024-01-02]" [path/to/logfile]
Show logs in local timezone
hl -L [path/to/logfile]
Read from stdin
cat [path/to/logfile] | hl
说明
hl is a high-performance log viewer and processor that converts JSON logs and logfmt logs into clear human-readable format. It automatically detects log formats and renders them with color-coded output for quick analysis. The tool supports field-based filtering, log level filtering, and timestamp range filtering. It automatically integrates with a pager (defaulting to less) and supports theme customization through configuration files.
参数
- -l _LEVEL_
- Filter by log level (debug, info, warn, error)
- -f _KEY=VALUE_
- Filter by field value
- --since _TIME_
- Show logs after this timestamp
- --until _TIME_
- Show logs before this timestamp
- -P
- Disable pager (streaming mode)
- -L
- Show timestamps in local timezone
- -Z _ZONE_
- Show timestamps in specified timezone
- --allow-prefix
- Process logs with non-JSON prefixes
FAQ
What is the hl command used for?
hl is a high-performance log viewer and processor that converts JSON logs and logfmt logs into clear human-readable format. It automatically detects log formats and renders them with color-coded output for quick analysis. The tool supports field-based filtering, log level filtering, and timestamp range filtering. It automatically integrates with a pager (defaulting to less) and supports theme customization through configuration files.
How do I run a basic hl example?
Run `hl [path/to/logfile.json]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -l _LEVEL_ do in hl?
Filter by log level (debug, info, warn, error)