The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ata - Apache Transfer-log Analyzer.

DESCRIPTION

ata is the report generator of traffic size and request count.

SYNOPSIS

ata <OPTIONS>

OPTIONS

-file < file_name >

log file name.

-format < regexp >

regular expression for parsing log file.

-f < field_name >

names of the fields a log file. Number of the `()` into regexp must correspond with number of the parameters `-f`. Multiple parameter.

-gb < field_name >

group by... Fields names for groupping report file records... Any names from parameter `-f`. For example `... -gb req_user -gb method` group by req_user ( /~user_name ) and method ( GET || POST | HEAD ... etc ). Multiple parameter. See examples for more info.

-order_by < field_name >

order by... Ordering output report records. Any names from parameter `-gb` and two reserved words: 'count' - request count, 'size' - traffic size. Multiple parameter.

-txt

output report into plain-text format.

-help

help.

-unit < unit_name >

unit of traffic ( B, K, M, G - Byte, Kilobyte, Megabyte, Gigabyte ).

-tr_size_fld < field_name >

field name ( from parameters `-f` ) for traffic size determination...

-show

visible work.

-dump < log_file_name >

dump incorrect log strings to `log_file_name`

EXAMPLES

log file ( logs ):

 cs4-mts-18.dialup.mts-nn.ru - - [09/Jun/2002:02:22:18 +0400] "GET /~gosha/path/nidex.html?param HTTP/1.0" 200 1160
 217.77.106.6 - - [09/Jun/2002:12:30:17 +0400] "GET /~gosha/hidden_index.html HTTP/1.0" 200 1704
 66.28.250.171 - - [09/Jun/2002:20:18:28 +0400] "GET /~gosha/info.html HTTP/1.0" 200 2087
 gorka.gcom.ru - - [13/Jun/2002:10:29:47 +0400] "GET /~gosha/ HTTP/1.0" 200 1160
 66.28.210.71 - - [15/Jun/2002:10:18:21 +0400] "GET /~alex/cgi-bin/view.cgi?id=1 HTTP/1.0" 200 122087
 66.28.210.71 - - [15/Jun/2002:10:19:21 +0400] "GET /~alex/cgi-bin/view.cgi?id=12 HTTP/1.0" 200 3087

command line:

 ata -file logs -gb req_user -gb date_day -gb lstatus -txt

result:

 Req_user, Date_day, Lstatus                             Count   Size
 --------------------------------------------------      ------- ----------
 gosha,09,200                                                  3 0,004722 M
 alex,15,200                                                   2 0,119375 M
 gosha,13,200                                                  1 0,001106 M
                                                         ------- ----------
                                                               6 0,125203 M

command line:

  ata -file logs -gb req_user -gb req_name -txt

result:

 Req_user, Req_name                                      Count   Size
 --------------------------------------------------      ------- ----------
 alex,view.cgi                                                 2 0,119375 M
 gosha,nidex.html                                              1 0,001106 M
 gosha,-                                                       1 0,001106 M
 gosha,hidden_index.html                                       1 0,001625 M
 gosha,info.html                                               1 0,001990 M
                                                         ------- ----------
                                                               6 0,125203 M

command line:

 ata -txt -file logs -gb req_user -gb req_ext -order_by req_user -order_by count

result:

 Req_user, Req_ext                                       Count   Size
 --------------------------------------------------      ------- ----------
 alex,cgi                                                      2 0.119375 M
 gosha,-                                                       1 0.001106 M
 gosha,html                                                    3 0.004722 M
                                                         ------- ----------
                                                               6 0,125203 M

NOTES

'Count' and 'Size' - reserved words, do not use this with parameter `-f`.

Percent calculating only for html report format.

regexp ( `-format` ) matching next log file format ( by default ):

 66.28.210.71 gosha - [15/Jun/2002:10:19:21 +0400] "GET /~alex/cgi-bin/view.cgi?id=12 HTTP/1.0" 200 3087

`-f` contain names of the fields ( for ^^^ this string, by default ):

 host           = 66.28.210.71
 login          = gosha
 user           = -
 datetime       = 15/Jun/2002:10:19:21 +0400
 date           = 15/Jun/2002
 date_day       = 15
 date_mon       = Jun
 date_year      = 2002
 time           = 10:19:21
 time_hour      = 10
 time_min       = 19
 time_sec       = 21
 method         = GET
 request        = /~alex/cgi-bin/view.cgi?id=12
 req_user       = alex
 req_path       = /cgi-bin
 req_name       = view.cgi
 req_ext        = cgi
 req_qstring= id=12
 proto          = HTTP/1.0
 lstatus        = 200
 byte           = 3087

any names from first column may be used with parameter `-gb`.

AUTHOR

 Okunev Igor V.  mailto:igor@prv.mts-nn.ru
                 http://www.mts-nn.ru/~gosha
                 ICQ 106183300

OFFICIAL SITE

http://www.mts-nn.ru/~gosha/perl-scripts/ata/hidden_index.html

COPYRIGHT

Copyright (c) 2004 Okunev Igor

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.