tail -f で出力されるログに色づけを行う
( diary )
#!/bin/perl
use strict;
use warnings;
while(<>) {
s/\[SQL\]/\033\[1;36m$&\033\[0m/g;
s/INSERT.+\n/\033\[1;32m$&\033\[0m/g;
s/UPDATE.+\n/\033\[1;34m$&\033\[0m/g;
s/SELECT.+\n/\033\[1;33m$&\033\[0m/g;
print;
}
tail -f access_log | perl ~/test.pl
