<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sebastian Mogilowskis Blog &#187; log</title>
	<atom:link href="http://www.mogilowski.net/lang/de-de/tag/log/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mogilowski.net</link>
	<description>Just another blog about administration, linux and other stuff</description>
	<lastBuildDate>Tue, 17 Jan 2012 13:42:30 +0000</lastBuildDate>
	<language>de-de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Log Apache2 access log into a MySQL database on Debian Lenny</title>
		<link>http://www.mogilowski.net/lang/de-de/2008/11/26/log-apache2-access-log-into-a-mysql-database-on-debian-lenny</link>
		<comments>http://www.mogilowski.net/lang/de-de/2008/11/26/log-apache2-access-log-into-a-mysql-database-on-debian-lenny#comments</comments>
		<pubDate>Wed, 26 Nov 2008 08:29:27 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[access log]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[mod-log-sql-mysql]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=176&#038;lang=de-de</guid>
		<description><![CDATA[Dieser Artikel beschreibt wie man Apache sein Access Log in eine MySQL Datenbank schreiben lässt. Man benötigt einen installierten und konfigurierten Apache2 Webserver sowie MySQL Datenbankserver. Installation: Auf dem Webserver: aptitude install libapache2-mod-log-sql-mysql a2enmod unique_id Auf dem Datenbankserver: Erstelle eine Datenbank &#8220;apachelogs&#8221; und einen entsprechenden Benutzer für diese Datenbank. Konfiguration des virtuellen Hosts: Ersetze &#8220;PASSWORD&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="de-de"> Dieser Artikel beschreibt wie man Apache sein Access Log in eine MySQL Datenbank schreiben lässt.</span></p>
<p><span lang="de-de"> Man benötigt einen installierten und konfigurierten Apache2 Webserver sowie MySQL Datenbankserver.</span></p>
<h3><span lang="de-de">Installation:</span></h3>
<p><strong><span lang="de-de"> Auf dem Webserver:</span></strong></p>
<pre>
aptitude install libapache2-mod-log-sql-mysql
a2enmod unique_id
</pre>
<p><strong><span lang="de-de"> Auf dem Datenbankserver:</span></strong></p>
<p><span lang="de-de"> Erstelle eine Datenbank &#8220;apachelogs&#8221; und einen entsprechenden Benutzer für diese Datenbank.</span></p>
<p><strong><span lang="de-de">Konfiguration des virtuellen Hosts:</span></strong></p>
<p><em><span lang="de-de"> Ersetze &#8220;PASSWORD&#8221; und &#8220;DATABASE_SERVER&#8221; mit deinen eigenen Daten.</span></em></p>
<pre>
LogSQLLoginInfo mysql://apachelogs:PASSWORD@DATABASE_SERVER/apachelogs
LogSQLCreateTables on
LogSQLDBParam socketfile /var/run/mysqld/mysqld.sock
LogSQLTransferLogFormat IAbPcMfRhluTrmHtUapzqQsSV

&#60;virtualhost www.testsrv.local:80&#62;
ServerName www.testsrv.local
ServerAdmin servermaster@testsrv.local
DocumentRoot /var/www/vhost1/htdocs
ErrorLog /var/www/vhost1/logs/error.log
CustomLog /var/www/vhost1/logs/access.log common

LogSQLTransferLogTable vhost1_access_log

&#60;/virtualhost&#62;
</pre>
<pre>
/etc/init.d/apache2 reload
</pre>
<p><span lang="de-de"><em>mod-log-sql-mysql wird nun eine Tabelle &#8220;vhost1_access_log&#8221; erstellen und die Access Log Einträge dort speichern.</em></span></p>
<h3><span lang="de-de">Probleme:</span></h3>
<p><span lang="de-de"> Es können verschiedene Probleme im Apache Error log auftauchen nach der Installation des Moduls:</span></p>
<p>1. &#8220;No such file or directory: attempted append of local preserve file &#8216;/etc/apache2/logs/mod_log_sql-preserve&#8217; but failed.&#8221;</p>
<p><span lang="de-de"> Man muss das Verzeichnis &#8220;/etc/apache2/logs&#8221; manuell anlegen oder einen entsprechenden Symlink auf &#8220;/var/log/apache2&#8243;.</span></p>
<p>2. &#8220;failed to create table: score_board&#8221;</p>
<p><span lang="de-de"> Es gibt ein Problem bei der automatischen Erstellung der &#8220;scoreboard&#8221; Tabelle, sie muss per Hand angelegt werden:</span></p>
<pre>
CREATE TABLE IF NOT EXISTS `scoreboard` (
`id` int(14) NOT NULL auto_increment,
`vhost` varchar(50) NOT NULL default '',
`bytes_sent` int(14) NOT NULL default '0',
`count_hosts` int(12) NOT NULL default '0',
`count_visits` int(12) NOT NULL default '0',
`count_status_200` int(12) NOT NULL default '0',
`count_status_404` int(12) NOT NULL default '0',
`count_impressions` int(18) NOT NULL default '0',
`last_run` int(14) NOT NULL default '0',
`month` int(4) NOT NULL default '0',
`year` int(4) NOT NULL default '0',
`domain` varchar(50) NOT NULL default '',
`bytes_receive` int(14) NOT NULL default '0',
PRIMARY KEY  (`id`),
UNIQUE KEY `vhost` (`vhost`,`month`,`year`,`domain`)
) TYPE=MyISAM;
</pre>
<p><span lang="de-de"> Danke an Alexandre Bulté für die Lösung !</span></p>
<h3>Links:</h3>
<p><a href="http://blog.bulte.net/2008/04/apache-modlogsql-problem-with.html" target="_blank">http://blog.bulte.net/2008/04/apache-modlogsql-problem-with.html</a><br />
<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" target="_blank">http://www.outoforder.cc/projects/apache/mod_log_sql/</a><br />
<a href="http://www.howtoforge.com/apache2-logging-to-a-mysql-database-with-mod_log_sql-on-debian-etch" target="_blank">http://www.howtoforge.com/apache2-logging-to-a-mysql-database-with-mod_log_sql-on-debian-etch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/de-de/2008/11/26/log-apache2-access-log-into-a-mysql-database-on-debian-lenny/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 19/30 queries in 0.016 seconds using apc
Object Caching 492/492 objects using apc
Content Delivery Network via cdn.mogilowski.net

Served from: www.mogilowski.net @ 2012-02-07 05:39:32 -->
