Linux command
ccze 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Colorize log file
cat [/var/log/syslog] | ccze
Follow log with colors
tail -f [/var/log/syslog] | ccze
Raw ANSI output for less
cat [logfile] | ccze -A | less -R
HTML output
cat [logfile] | ccze -h > [output.html]
Disable lookups for speed
cat [logfile] | ccze -A -o nolookups | less -R
List available plugins
ccze -l
Colorize using only a specific plugin
cat [logfile] | ccze -p [httpd]
Use an alternate configuration file
cat [logfile] | ccze -F [~/.my_cczerc] -A
说明
ccze is a robust log colorizer written in C, designed as a drop-in replacement for colorize with better performance and lower resource usage. It reads log data from standard input and outputs colorized text using ncurses, raw ANSI escape codes, or HTML. The tool uses a plugin architecture to recognize and colorize different log formats including syslog, Apache httpd, Postfix, Squid, Exim, fetchmail, procmail, and vsftpd. Each plugin understands the structure of its target log format and applies appropriate colors to timestamps, hostnames, severity levels, and other fields. Output defaults to ncurses mode but the `-A` flag produces raw ANSI output suitable for piping to `less -R` or other tools.
参数
- -a _PLUGIN=ARGUMENTS_, --argument _PLUGIN=ARGUMENTS_
- Pass whitespace-separated arguments to the specified plugin.
- -A, --raw-ansi
- Generate raw ANSI color sequences instead of using ncurses.
- -c _KEY=COLOR_, --color _KEY=COLOR_
- Set the color of a keyword, as in configuration files.
- -C, --convert-date
- Convert UNIX timestamps to human-readable date format (e.g. in squid or oops logs).
- -F _rcfile_, --rcfile _rcfile_
- Read the specified file as configuration instead of the defaults.
- -h, --html
- Generate HTML output instead of console colors.
- -l, --list-plugins
- List all available (loaded) plugins with their type and description.
- -m _mode_, --mode _mode_
- Set output mode: _curses_, _ansi_, or _html_.
- -o _option_, --options _option_
- Toggle a feature. Available options: scroll, wordcolor, lookups, transparent, cssfile. Prefix with "no" to disable (e.g., nolookups). All are enabled by default except cssfile.
- -p _plugin_, --plugin _plugin_
- Load only the specified plugin(s) for a slight speedup.
- -r, --remove-facility
- Remove syslog-ng facility level information from log lines.
- -V, --version
- Display version information.
- --help
- Display usage summary and exit.
FAQ
What is the ccze command used for?
ccze is a robust log colorizer written in C, designed as a drop-in replacement for colorize with better performance and lower resource usage. It reads log data from standard input and outputs colorized text using ncurses, raw ANSI escape codes, or HTML. The tool uses a plugin architecture to recognize and colorize different log formats including syslog, Apache httpd, Postfix, Squid, Exim, fetchmail, procmail, and vsftpd. Each plugin understands the structure of its target log format and applies appropriate colors to timestamps, hostnames, severity levels, and other fields. Output defaults to ncurses mode but the `-A` flag produces raw ANSI output suitable for piping to `less -R` or other tools.
How do I run a basic ccze example?
Run `cat [/var/log/syslog] | ccze` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a _PLUGIN=ARGUMENTS_, --argument _PLUGIN=ARGUMENTS_ do in ccze?
Pass whitespace-separated arguments to the specified plugin.