Due to little time I need help writing a small (bash) script to
process apache2 logfiles from multiple servers(load balanced) with mass vhost configs.
I've made a start but the script needs more features.
This is the description of the script (see also attached file)
# Apache2 mass vhost logs and AW stats script
# Awstats and Vlogger Rotation
# access log filename can be variable, for vlogger default name is [url removed, login to view]
# apache vhost config filename can be [url removed, login to view] [url removed, login to view] or just [url removed, login to view]
# look for directories in Apache's log directory and use their names
#1. Get the vhost log files from all webservers
# webservers = " web1 web2 web3"
# webservers = "localhost" if you have only one webserver
# scan and scp the log directories of the webserver for vhost directories
# get yesterdays log file
# start from logfile = /var/log/apache2
#after successfull copy (check with i.e. crc), remove log files from the webserver (leave current [url removed, login to view])
# ALL WEBSERVERS HAS THE SAME logfilename! must be copied as [url removed, login to view] before step2
#2. Merge the different webserver logs to one vhost logfiles
# if webservers has more than one server
# Use AWSTATS [url removed, login to view]
#to merge several log files into one output, sorted on date.
#3. Run awstats
# if logfile directory exist check for vhost config in /etc/apache2/sites-available
# make a awstats config with the variables in vhost config
# variables aw = variable apache conf
# SiteDomain = ServerName
# HostAliases = ServerAlias
# DirData = DocumentRoot + /logs (put logs in a variable)
# Include "/etc/awstats/awstats-common.conf"
#4. Move the logfiles to the homedirs
# Look in vhost config for DocumentRoot
# Move logfile of this host to the DocumentRoot+/logs for this vhost
# gzip logfiles + remove older files than 7 days or x days
#5. Make a small report for admins
# as a txt file in the process dir (filename i.e. [url removed, login to view])
# which domains are processed
# print error (if any)
Please check the attachment for my script and this description.
If you have any suggestions please mail me with your offer.
I'll pick who has the most efficient idea and the fastest.
If you have a script of this sort, you can earn easy (as I'm not the only one who needs this kind of script) Script must be easy cutomizeable (like dirs, filenames, dates etc...)