| 1 |
|
| 2 |
Colortail |
| 3 |
0.3 |
| 4 |
|
| 5 |
|
| 6 |
------ |
| 7 |
This software is Copyright (C) 2009 by Joakim Ek |
| 8 |
<[email protected]>. I accept no responsibility for any damage this |
| 9 |
software may or may not do to your system - you use it completely at your |
| 10 |
own risk. This software comes under the GPL license. See the COPYING file |
| 11 |
for full legal details. |
| 12 |
------ |
| 13 |
|
| 14 |
This file contains: |
| 15 |
|
| 16 |
1. Overview |
| 17 |
2. Background |
| 18 |
3. Features |
| 19 |
4. Installing |
| 20 |
5. Usage |
| 21 |
6. Standard disclaimer |
| 22 |
7. Bugs |
| 23 |
8. Thanks |
| 24 |
|
| 25 |
|
| 26 |
1. OVERVIEW |
| 27 |
|
| 28 |
Colortail works like tail but can optionally read one or more config files |
| 29 |
where it's specified which patterns results in which colors. |
| 30 |
|
| 31 |
Colortail uses regular expressions (see regex(7)) to determine which lines and |
| 32 |
parts of lines to print in which colors. |
| 33 |
|
| 34 |
|
| 35 |
2. BACKGROUND |
| 36 |
|
| 37 |
My thoughts about colortail started when I was running a |
| 38 |
tail -f -q /var/log/foo /var/log/bar in the background of my irc session and I |
| 39 |
wanted to quickly see if something strange was going on. I wanted different |
| 40 |
lines in different colors so it's easy to see what is happening. I searched on |
| 41 |
the internet but didn't find any program that did what I wanted. So I started |
| 42 |
to code on colortail. Version 0.1 didn't use regular expressions but instead |
| 43 |
had a somewhat DOSish config format with '*' and '?'. In 0.2 I changed to |
| 44 |
regular expressions. After 0.2 I didn't do much with colortail for a long |
| 45 |
while, but then I got a patch, that made it possible to print just parts of |
| 46 |
lines in a color, I got some new inspiration but because the code was a big |
| 47 |
mess I decided to do a rewrite in C++. I like the modularity that the C++ |
| 48 |
classes "forces" one to do. And because I've been brainwashed with Java in |
| 49 |
school I find the object view the most natural. |
| 50 |
|
| 51 |
|
| 52 |
3. FEATURES |
| 53 |
|
| 54 |
OK, so what is this colortail thing good for? |
| 55 |
|
| 56 |
I can't say that colortail is a substitute for tail, not yet anyway. Right |
| 57 |
now colortail lacks some major features the tail has. But I'll add this |
| 58 |
features in the next releases. |
| 59 |
|
| 60 |
BUT, colortail has something that tail lacks. The ability to do colored output. |
| 61 |
How may this come in handy? Well, it's mostly useful then looking at log files |
| 62 |
(it's what I use it for anyway, it may very well be other uses for it as well, |
| 63 |
if you have found something that colortail is useful for please send a mail |
| 64 |
telling me of it). In the case of looking at log files I have configured |
| 65 |
colortail to do this: |
| 66 |
(standard log file made my syslog (/var/log/messages)): |
| 67 |
|
| 68 |
(I split the line) |
| 69 |
|
| 70 |
Aug 4 23:14:53 morrdusk kernel: Packet log: ppp-in DENY ppp0 PROTO=6 |
| 71 |
[-1--] [--2---] [--3---] [--4--] [---5-----] [-----6--------] [--5--] |
| 72 |
|
| 73 |
xxx.xx.xxx.xxx:xxxxx xxx.xxx.x.xxx:xx L=44 S=0x00 I=58022 F=0x4000 T=53 |
| 74 |
[-----7------][--5-] [------7-----][----------------5-----------------] |
| 75 |
|
| 76 |
The above is colorized as this: |
| 77 |
The [-1-] part is in magenta |
| 78 |
The [-2-] part is in cyan |
| 79 |
The [-3-] part is in green |
| 80 |
The [-4-] part is in yellow |
| 81 |
The [-5-] part is in brightblue |
| 82 |
The [-6-] part is in brightred |
| 83 |
The [-7-] part is in brightyellow |
| 84 |
|
| 85 |
|
| 86 |
It may be hard to imagine how it looks but I think it looks better than the |
| 87 |
all white output from tail. And I like to have all the more serious things |
| 88 |
colored in bright red color. It then only takes a glance to see that |
| 89 |
something has happened and one can take a closer look at that line. I also have |
| 90 |
all ip addresses in bright yellow so that they are easy to see. |
| 91 |
|
| 92 |
This is in no way hardcoded, all is controlled in the configuration files. |
| 93 |
That can be one configuration file for each tail file then tailing more than |
| 94 |
one file or if only one configuration file is given it's used as a global |
| 95 |
configuration file, affecting all the tail files. |
| 96 |
|
| 97 |
|
| 98 |
4. INSTALLING |
| 99 |
|
| 100 |
Colortail should work on most unix system that have g++. I have developed it |
| 101 |
on a Redhat linux system. |
| 102 |
I have integrated a bsd patch I got for 0.2 but I may have added some |
| 103 |
strange code in the rewrite that bsd doesn't like. |
| 104 |
There shouldn't be a problem on other systems, but if you have to change |
| 105 |
something to get it to work on your system, please send me a patch. |
| 106 |
|
| 107 |
To install colortail this should be enough: |
| 108 |
From the toplevel colortail source tree directory: |
| 109 |
./configure |
| 110 |
make |
| 111 |
su |
| 112 |
make install |
| 113 |
|
| 114 |
After that you may want to copy and edit the example config files to some |
| 115 |
other place. I have them in ~/.colortail/ |
| 116 |
|
| 117 |
If you don't have the GNU regex library, it can be found at |
| 118 |
ftp.funet.fi/pub/gnu/prep/regex/ |
| 119 |
|
| 120 |
|
| 121 |
5. USAGE |
| 122 |
|
| 123 |
Most options are easily understanded. The only somewhat strange option is |
| 124 |
the -k option that specifies the config files so colortail knows what should |
| 125 |
be printed in which color. |
| 126 |
|
| 127 |
If only one config file and one or more tail files is given the config file |
| 128 |
is treated as a global one, i.e. |
| 129 |
|
| 130 |
colortail -k conf.global file1 file2 file3 |
| 131 |
|
| 132 |
Multiple config files are separated with a , and if one tail file shouldn't |
| 133 |
have a config file just leave it blank, i.e. |
| 134 |
|
| 135 |
colortail -k conf.file1,,conf.file3 file1 file2 file3 |
| 136 |
|
| 137 |
|
| 138 |
6. STANDARD DISCLAIMER |
| 139 |
|
| 140 |
The author don't take any responsibility for any damage this program may do. |
| 141 |
I'm doing this in my spare time. If you don't like this program don't use it. |
| 142 |
|
| 143 |
|
| 144 |
7. BUGS |
| 145 |
|
| 146 |
Please read the BUGS file. There I describe a very annoying bug that exists |
| 147 |
in tail too. I haven't yet found anyway to fix this. |
| 148 |
It you have a solution to that problem or if you have found another bug, |
| 149 |
please send a mail to [email protected] |
| 150 |
|
| 151 |
|
| 152 |
8. THANKS |
| 153 |
|
| 154 |
Thanks to: |
| 155 |
Joey Hess for multicolored lines patch. |
| 156 |
Nic Bellamy for FreeBSD and OpenBSD compatability patch. |
| 157 |
Edward Betts for making debian packages. |
| 158 |
Justin Piszcz for extensive 64-bit testing. |
| 159 |
|