Skip to content

kyanny/p5-App-AccessLogFilter-Colored

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME
    access-log-filter-colored.pl - poor grep(1) for
    combined/extended log with color

SYNOPSIS
        $ access-log-filter-colored.pl 'filter expression' < /var/log/httpd/access_log
   
        options:
         -c, --color      specify highlight color 
         --conf           specify config file for log format customize (see CUSTOMIZE section)
         -h, -?, --help   print help message
         -v, --version    print version string

    examples:

        $ access-log-filter-colored.pl '$line{status} == 500' < /var/log/httpd/access_log
   
        $ access-log-filter-colored.pl --color=red '$line{method} eq "POST"' < /var/log/httpd/access_log
   
        $ access-log-filter-colored.pl --conf -- '$line{agent} =~ /iphone/i' < /var/log/httpd/access_log
   
        $ tailf /var/log/httpd/access_log \
            | access-log-filter-colored.pl '$line{method} eq "POST"' -c yellow --conf\
            | access-log-filter-colored.pl '$line{agent} =~ /flash/i' -c magenta --conf

CUSTOMIZE
    You can customize log format. When --conf option passed,
    $HOME/.App-AccessLogFilter-Colored will load. When --conf=/path/to/file
    option passed, the file /path/to/file will load. Config file is Perl
    script.

    example:

        # LogFormat  "%h %l %u %t \"%r\" %>s %b %D %X \"%{Referer}i\" \"%{User-Agent}i\""
    
        @parts = qw(host ident user time method resource proto status bytes microseconds connection referer agent);
        $regexp = qr/^([^ ]*) ([^ ]*) ([^ ]*) \[([^]]*)\] "([^ ]*)(?: *([^ ]*) *([^ ]*))?" ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) "(.*?)" "(.*?)"/;
        $log_format = q!%s %s %s [%s] "%s %s %s" %s %s %s %s "%s" "%s"!;
    
        1;

SEE ALSO
     L<Term::ANSIColor> for more details about color name
     L<http://pmakino.jp/tdiary/20070907.html> (thanks for regexp)

AUTHOR
    Kensuke Nagae <kyanny at gmail dot com>

LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

About

access-log-filter-colored.pl - poor grep(1) for combined/extended log with color

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages