adi

Web Developer

cl

Analytics for HTTP logs in Common Log Format

Install

On a Linux or BSD machine, in a terminal, run:

mkdir -p ~/src
cd ~/src
wget -qO - https://adi.onl/cl/cl@1.0.0.tgz | tar -xzvf -
cd cl
make install PREFIX=$HOME

Uninstall

cd ~/src/cl
make uninstall PREFIX=$HOME

Usage

The package provides 6 scripts clp, clu, clv and clvp, clvu and clvv.

The cl prefix stands for Common Log and the suffixes stand for pages, unique and views.

The middle v in the second set stands for virtual host. The second set of 3 scripts is for the Common Log with virtual hosts format. It's identical to the normal Common Log except the name of the virtual host is prepended to each line.

Use the appropriate script for the statistic and for the log format:

Pages

$ clp /var/www/access.log
/docs.html 641
/ 3227

Use sort -nrk 2 to sort on second column:

$ clp /var/www/access.log | sort -nrk 2
/ 3227
/docs.html 641

Uniques and Visits

Uniques and visits scripts output the actual unique and visit requests by default. Use wc -l to count:

$ clu /var/www/access.log | wc -l
    2000

The scripts operate on GET requests to paths with no extension or ending in .html that returned a 200 HTTP response status code.

https://example.com/docs
https://example.com/docs/
https://examples.com/docs.html

Files

Download

Changelog

1.0.0 - 2022-03-04

Added

Changed

Removed

0.1.1

Added

[0.1.0]

Added