Scroll to navigation

clog(1) User Manuals clog(1)

NAME

clog - colorized log filter

SYNOPSIS

clog [<options>] [<section> ...]


-h|--help Show this usage
-v|--version Show this version
-d|--date Prepend all lines with the current date
-t|--time Prepend all lines with the current time
-f|--file Override default ~/.clogrc

DESCRIPTION

Clog is a filter command, and therefore copies its input to its output. But if lines in the input match certain patterns, actions are taken, which are defined as 'rules'.

The rules are defined in ~/.clogrc as text patterns or regular expressions, and the actions are specified, to colorize either the line or matching pattern, or perhaps to suppress the line.

If --date is specified the current date, YYYY-MM-DD, is prepended to all lines.

If --time is specified the current time, HH:MM:SS, is prepended to all lines.

If --file is specified, an alternate configuration rc file may be specified. Default is to ~/.clogrc

One or more section arguments may be specified. If none are provided, 'default' is assumed. A section corresponds to a named rule set defined in ~/.clogrc. and allows the use of one .clogrc file to serve multiple different uses of clog. If more than one section is specified, the rules sets are combined, in the sequence found.

CONFIGURATION FILE AND OVERRIDE OPTIONS

Clog reads its configuration from a file in the user's home directory: ~/.clogrc.

The format of the rules is:

<section> rule /<pattern>/ --> <color> <action>
<section> rule "<pattern>" --> <color> <action>

If the pattern is surrounded by / characters, it is interpreted as a regular expression. If the pattern is surrounded by " characters, it is interpreted as a string fragment.

The section is simply a way to allow multiple rules sets, so that one .clogrc file can serve multiple uses. The pattern may be any supported Standard C Library regular expression. Action must be one of 'line', 'match', 'suppress' or 'blank'.

Note that there is a default section, called 'default'. Putting rules in the default section means that no section need be specified on the command line.

Any color can be used, in both the 16- and 256-color space. Some examples are:

bold
underline
bold blue
underline on green
black on white
bold red on bright white
rgb200 on grey4

Instead of coloring the whole line, specifying 'match' instead will only color the parts of the line that match.

EXAMPLE Rulesets

Here is an example ~/.clogrc file.

# Standard syslog entries.
default rule /warn|debug/ --> yellow line
default rule /error|severe/ --> red line
default rule /critical/ --> bold red line
default rule /critical/ --> blank
default rule /ignore/ --> suppress

# Apache access.log status codes
apache rule / 2[0-9][0-9] / --> green match
apache rule / 3[0-9][0-9] / --> yellow match
apache rule / 4[0-9][0-9] / --> red match
apache rule / 5[0-9][0-9] / --> bold red match

CREDITS & COPYRIGHTS

Copyright (C) 2006 - 2016 P. Beckingham, F. Hernandez.
Copyright (C) 2006 - 2016 Goteborg Bit Factory.

Clog is distributed under the MIT license. See http://www.opensource.org/licenses/mit-license.php for more information.

SEE ALSO

For more information, see:

<http://tasktools.org/clog.html>

<https://git.tasktools.org/scm/ut/clog.git>

<support@taskwarrior.org>

REPORTING BUGS

<https://bug.tasktools.org/>

2016-06-27 ${PACKAGE_STRING}