<< Back Home UK uk   Donate Donate

Parser for Squid-logs and Apache-logs (traffic counter)

Alter ( (remove X))
based on code by Taras Nizhnik ( (remove X))

  • Last version: squidstat_v3.rar/tgz (3.1 Kb/3.3 Kb)
    - Log-based Traffic counter for Squid with following features:
    • traffic aggregation by user, user-IP, server-IP, parent-proxy
    • traffic for specified period of time
    • local traffic (you have to update script with your local resources list)
    • blocked traffic (TCP_DENIED in Squid)
    • can separately account 'day' and 'night' traffic.
    • supports log rotation.
    • can process only part of log-file. You can specify starting line or byte posistion and maximum number of lines to be processed.
    squidstat               without params accounts traffic for current month.
    -last                   account previous month.
    -rotate                 perform log rotation. run it from cron.
    -d <date>               traffic for the day or month, specified by
                            <date> (of current year)
    -d <date1> - <date2> - traffic for the period since <date1> till
                            <date2> of current year.
    -byip                   aggregate counters by client's IP. By default username is used.
    -l <NUM>                start log processing on line NUM.
    -c <NUM>                process not more than NUM log lines.
    -lseek <NUM>            seek to NUM bytes offset.
    -day_begin <HH>         'day' begins at HH o'clock
    -night_begin <HH>       'night' begins at HH o'clock
    -parent <PEER>          account only traffic directed to parent-proxy <PEER>
    -sep_parent             account separately direct traffic and traffic passed to any parent-proxy
    -sep_all_parents        account separately direct traffic, cached and passed to each parent-proxy
    -nosep                  do not print in report decimal digit separators (spaces)
    -nodirect               do not account direct traffic
    -direct                 account direct traffic only
    -ip <IP>                account only traffic produced by client with specified IP
    -bytargetip             make server-based accounting
    <date> formats:
    <month>        - month number: Jan - 1, Feb - 2, Mar - 3, etc.
                           0 - current
                           -1 - previous, -2 - before previous, etc.
    <month> <mday> - month number (see above) and day.


First version: squidstat_v1.rar/tgz (2.2 Kb/2.3 Kb)

squidstat_v1a.rar/tgz (2.2 Kb/2.3 Kb)
New switch is added. Now by default squidstat counts traffic per user. With -byip switch it will count per client's IP.

squidstat_v3.rar/tgz (3.1 Kb/3.3 Kb)
So many changes... And everything is for efficient accounting of users.

See also:

FB or mail (remove X)   Share
designed by Alter aka Alexander A. Telyatnikov powered by Apache+PHP under FBSD © 2002-2024