A little script that pulls data chunks out of AWStats flat files and saves them to CSV
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



This is a fairly simple PHP script which can be included in any app.

It takes a .txt file generated by AWStats and strips out the main chunks of data, spitting it back out into csv files.

Examples for running from cli and $_GET are included.


The main function can be found in core.php, but the example given in cli.php can get you using the script straight away.

First you need to locate your awstats data files. These will likely be in your awstats/wwwroot/cgi-bin folder and named something like awstats[mm][yyyy].[your-config-name].txt (obviously, replace the month, year and config names apropriately)

Run cli.php from the command line with: php cli.php path/to/data/file.

This will then generate a number of csv files in the outputs folder of the script containing the data from the various chunks of the awstats file.