Skip to content
cdgraff edited this page Jul 10, 2012 · 11 revisions

Dependencies

OS dependencies (Based on RHEL 6 /Centos 6):

 rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
 yum install -y python-pip MySQL-python

Install Python dependencies:

 pip-python install pyparsing pygeoip

GEOIP dependencies:

 mkdir -p /usr/share/GeoIP
 cd /usr/share/GeoIP
 /usr/bin/wget -N -P /usr/share/GeoIP/ http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
 /usr/bin/wget -N -P /usr/share/GeoIP/ http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
 gzip -d /usr/share/GeoIP/GeoIP.dat.gz
 gzip -d /usr/share/GeoIP/GeoLiteCity.dat.gz

Logrotate

Move logrotate from daily to hourly

 mv /etc/cron.daily/logrotate /etc/cron.hourly/

Create logrotate config file for icecast

 cat <<EOF> /etc/logrotate.d/icecast
 /var/log/icecast/*.log {
        rotate 3
        nodateext
        copytruncate
        olddir /var/log/icecast/old
        compress
        delaycompress
        size 10k
        sharedscripts
        missingok
        postrotate
                /usr/bin/python /usr/local/bin/icecast-logs-parser
        endscript
 }
 EOF

Crontab

This script run using Crontab every 5 minutes or the time you choose

 5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/sbin/logrotate -f /etc/logrotate.d/icecast

NOTE: Here don't need setup 0 into the crontab, into the previous step, we move logrotate execution by hours, this way at 0 minutes will be run too, if we put 0 into this line will run 2 times the same script.

Clone this wiki locally