Laboratorium Komputerowe Progmar
Marcin Załęczny

We are using cookies in the page. If you use the page you agree for the cookies.      Close

How to create apache log visit statistics with tool awstats

At first create web.log.txt file. Then cat to this file all log files (syntax of apache's access.log) which you want to include in generated statistics:

  • Install tool:
    sudo apt-get install awstats
  • Set SiteDomain variable in /etc/awstats/awstats.conf configuration file, ex:
  • Within directory where web.log.txt file exists, execute following commands:
    • /usr/lib/cgi-bin/ -update -config="" -LogFile="./web.log.txt"
    • /usr/lib/cgi-bin/ -config="" -output -staticlinks >./stats.html
  • Now in the current directory you get the stats.html file which you can view in any webbrowser.
How to fastly create web.log.txt log file for hosting in

Copy all log files to a local directory. Their names are of following syntax web.log.RRRRMMDD.txt, where RRRR stands for year, MM - for month, DD - for day. They are all (excluding today file) compressed with gzip command. Now we rename this files to add to them gz extension. Thanks it the gunzip command will successfully uncompress them: find . -name "web.log.*" -exec mv {} {}.gz \;

Uncompress the above files: find . -name "web.log.*.gz" -exec gunzip {} \;

The last thing we have to do is to concatenate extracted log files to one summary web.log.txt file: find . -name "web.log.*.txt" -exec cat {} >>web.log.txt \;