Archive for October 8th, 2008

AWstats CentOS rpmforge

Wednesday, October 8th, 2008

Setup and configuration of AWstats from rpmforge on CentOS. Install awstats package: yum install awstats install Perl GeoIP to get country info yum install perl-Geo-IPfree Setup awstats config file: cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.www.domain.tld.conf vi /etc/awstats/awstats.www.domain.tld.conf edit at least the following lines: LogFile="/var/log/httpd/access_log" SiteDomain="localhost.localdomain" LoadPlugin="geoipfree" (uncomment) and set them to the appropriate files Run awstats_updateall /usr/bin/awstats_updateall.pl now -awstatsprog=/var/www/awstats/awstats.pl and add to cron crontab -e 0 * * * * ...

Convert Apache logs from common to combined format

Wednesday, October 8th, 2008

Here's a nice post to convert Apache logs from the common to the combined format. AWstats needs the combined format to correctly parse the log files. Overview of commands 1. find where combined start and common ends: cat access.log | grep -n -m 1 "\\" \\"" 2. split the file there: csplit --prefix=access.log access.log numberfoundin1 3. ...

Updating database field

Wednesday, October 8th, 2008

Client wanted contents of db field to be exchanged. So x y somepattern z z should become somepattern x y z z Added column to the table alter table prefix_user add tmp_username varchar(100); alter table prefix_user add firstname_backup varchar(100); now update tmp_username based on firstname update prefix_user set firstname_backup = firstname where id = id; select ltrim(concat_ws(' ...