Analytic

Thursday, July 11, 2013

Amazon AWS - Changing dynamically Apache Log File name based on Hostname

Change your vhost apache config as follow (the LogFormat writes correct client IPs to log):


LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined_new
CustomLog "|cat >> /shared/log/apache2/`hostname`-access.log" combined_new

Tuesday, July 2, 2013

Mysqldump only tables with certain prefix / Mysqldump wildcards

This commans will dump the tables with prefix PREFIX:

mysql DATABASE -u USERNAME -p -e 'show tables like "PREFIX%"' | grep -v Tables_in | xargs mysqldump DATABASE -u USERNAME -p > DUMP.sql