Smartlab Software logo

AWStats: Create Report Batch Files

AWStats logoThe code is shown for batch files that create the necessary log file, update or create the AWStats database, and create daily, weekly, or monthly reports on your computer.

Steps

  1. Acquire AWStats, other programs, and pertinent information
  2. Install AWStats on the 1and1 shared server
  3. Install AWStats on your computer
  4. Set up the AWStats config file
  5. Create a usable log file
  6. Create/update the AWStats database
  7. Create a traffic web page
  8. Create report batch files
  9. Analyze the traffic page
  10. Tasks

Extending AWStats

  1. Extras
  2. Geographic Plug-ins

Help

  1. Glossary
  2. FAQ
  3. Pages not found FAQ
  4. Stop Referrer Spam

Batch File Creation

Several batch files are shown here which are a culmination of the lessons so far.

 Daily Report Batch File

The batch file, make-daily-reports.bat, can handle spaces in the LOCALPATH directory name.

 @echo off
set LOCALPATH=d:\dev\awstats
rem
rem create access.daily.log
rem
cd "%LOCALPATH%\daily"
"%LOCALPATH%\mytools\gzip.exe" -dfvc access.log.*.gz > "%LOCALPATH%\daily\access.daily.log"
rem
rem create weekly traffic report
rem
perl "%LOCALPATH%\wwwroot\cgi-bin\awstats_buildstaticpages.pl" -config=daily -update -awstatsprog="%LOCALPATH%\wwwroot\cgi-bin\awstats.pl" -dir="%LOCALPATH%\daily"

 Weekly Report Batch File

The batch file, make-weekly-reports.bat, can handle spaces in the LOCALPATH directory name.

@echo off
set LOCALPATH=d:\my dev\awstats
set month=12
set year=2008
rem
rem create access.weekly.log
rem
cd "%LOCALPATH%\weekly"
"%LOCALPATH%\mytools\gzip.exe" -dfvc access.log.*.gz > "%LOCALPATH%\weekly\access.weekly.log"
rem
rem create weekly traffic report
rem
perl "%LOCALPATH%\wwwroot\cgi-bin\awstats_buildstaticpages.pl" -config=weekly -update -awstatsprog="%LOCALPATH%\wwwroot\cgi-bin\awstats.pl" -dir="%LOCALPATH%\weekly" -month=%month% -year=%year%
cd "%LOCALPATH%\mytools"

Monthly Report Batch File

The batch file, make-monthly-reports.bat, can handle spaces in the LOCALPATH directory name.

 @echo off
set month=11
set year=2008
set LOCALPATH=d:\dev\awstats
rem
del /Q "%LOCALPATH%\monthly\*.*"
rem
rem create combined log from several weekly logs
rem
cd "%LOCALPATH%\merge"
"%LOCALPATH%\mytools\gzip.exe" -dfv access.log.*.gz
perl "%LOCALPATH%\wwwroot\cgi-bin\logresolvemerge.pl" "%LOCALPATH%\merge\access.log.*" > "%LOCALPATH%\monthly\access.month.log"
rem
rem create monthly traffic report
rem
perl "%LOCALPATH%\wwwroot\cgi-bin\awstats_buildstaticpages.pl" -config=%month%.%year% -update -month=%month% -year=%year% -awstatsprog="%LOCALPATH%\wwwroot\cgi-bin\awstats.pl" -dir="%LOCALPATH%\monthly"
rem
rem delete access logs
rem
rem del /Q "%LOCALPATH%\merge\*.*"Log Creation Online

Next: Analyze AWStats traffic reports