Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 28th April 2009, 18:14
bulgin bulgin is offline
Junior Member
 
Join Date: Apr 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Apache2: Logging To A MySQL Database With mod_log_sql (Debian Etch)

Thank you Falko for the excellent tutorial on logging to MySQL. I refer
to it frequently when doing an install.

Now I'm up against a problem I cannot solve.

I am using:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.2"

However, now my error.log always show an error as follows and I am
having a heck of a time solving it. It is filling up my logs. I
thought you might have a clue you could pass to me.

Thanks.

Jeffrey



[Sun Apr 26 18:10:01 2009] [error] [client 193.200.150.125] File does
not exist: /var/www/web1/web/keys.ccm
[Sun Apr 26 18:10:01 2009] [error] mysql_query returned (1)
[Sun Apr 26 18:10:01 2009] [error] table does not exist, preserving query
[Sun Apr 26 18:10:01 2009] [error] table doesn't exist...creating now
[Sun Apr 26 18:10:01 2009] [error] failed to create table: score_board
[Sun Apr 26 18:10:01 2009] [error] (1)Operation not permitted: child
attempted but failed to create one or more tables for 142.23.62.121,
preserving query
[Sun Apr 26 18:10:01 2009] [error] (13)Permission denied: attempted
append of local preserve file '/etc/apache2/logs/mod_log_sql-preserve'
but failed.
[Sun Apr 26 18:10:01 2009] [error] mysql_query returned (1)
[Sun Apr 26 18:10:01 2009] [notice] db reconnect successful
[Sun Apr 26 18:10:01 2009] [error] mysql_query returned (1)
[Sun Apr 26 18:10:01 2009] [error] second attempt failed
[Sun Apr 26 18:10:01 2009] [error] (13)Permission denied: attempted
append of local preserve file '/etc/apache2/logs/mod_log_sql-preserve'
but failed.
Reply With Quote
Sponsored Links
  #2  
Old 29th April 2009, 12:57
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts
Default

Are the MySQL login details in your Apache configuration correct?

Have you tried to turn on MySQL query logging to see what is going on?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 29th April 2009, 17:14
bulgin bulgin is offline
Junior Member
 
Join Date: Apr 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Falko. I am getting logging to my database, it's just that I am also getting the regular apache error logs filled up with those error messages. So the login credentials must be good. Here are the details of my configuration, followed by output of apache logs and mysql.log:


LogSQLLoginInfo mysql://loguser_login_name:loguser_login_password@localhos t/apachelogs
LogSQLCreateTables on
LogSQLDBParam socketfile /var/run/mysqld/mysqld.sock
LogSQLTransferLogFormat AbHhmRSsTUuvI
LogSQLTransferLogTable web_log

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mysite.com
ServerAlias www.msyite.com
DocumentRoot /home/path/public_html/directory
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/path/public_html/directory>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel notice

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
================================================== =======
output of mysql.log (I cannot see any errors here writing to the score_board table):

090429 15:13:40 115 Connect loguser@localhost on apachelogs
090429 15:13:47 114 Query insert into web1_access_log (agent,bytes_sent,request_protocol,remote_host,req uest_method,referer,time_stamp,st
atus,request_duration,request_uri,remote_user,virt ual_host,id) values ('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/200904231
6 Firefox/3.0.10','181','HTTP/1.1','mail.domainname.com','GET','-','1241018027','404','0','/ship.ccm','-','domainname.com','Sfh8AAAEAAEW1BG8AAAA
A')
114 Query insert ignore into scoreboard (domain,vhost,month,year,count_impressions) values ('www','default-domain.tld','0
4','2009','0')
114 Query create table if not exists `score_board
114 Query update scoreboard SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+181 WHERE domain='www' AN
D vhost='default-domain.tld' AND month='04' AND year='2009'
114 Quit
116 Connect loguser@localhost on apachelogs
116 Query update scoreboard SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+181 WHERE domain='www' AN
D vhost='default-domain.tld' AND month='04' AND year='2009'
090429 15:13:59 117 Connect debian-sys-maint@localhost on
117 Quit

================================================== =======
Yet the output of the apache error logs show this:

[Wed Apr 29 15:13:47 2009] [error] mysql_query returned (1)
[Wed Apr 29 15:13:47 2009] [error] table does not exist, preserving query
[Wed Apr 29 15:13:47 2009] [error] table doesn't exist...creating now
[Wed Apr 29 15:13:47 2009] [error] failed to create table: score_board
[Wed Apr 29 15:13:47 2009] [error] (1)Operation not permitted: child attempted but failed to create one or more tables for www.domainname.com, preserving query
[Wed Apr 29 15:13:47 2009] [error] mysql_query returned (1)
[Wed Apr 29 15:13:47 2009] [notice] db reconnect successful
[Wed Apr 29 15:13:47 2009] [error] mysql_query returned (1)
[Wed Apr 29 15:13:47 2009] [error] second attempt failed
[Wed Apr 29 15:14:07 2009] [notice] caught SIGTERM, shutting down

Last edited by bulgin; 29th April 2009 at 18:21.
Reply With Quote
  #4  
Old 30th April 2009, 17:46
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts
Default

Quote:
Originally Posted by bulgin View Post
114 Query insert ignore into scoreboard (domain,vhost,month,year,count_impressions) values ('www','default-domain.tld','0
4','2009','0')
114 Query create table if not exists `score_board
114 Query update scoreboard SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+181 WHERE domain='www' AN
D vhost='default-domain.tld' AND month='04' AND year='2009'
In the MySQL log, there are references to the tables score_board and scoreboard. Do both tables exist, just one (which one), or none of them?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 1st May 2009, 19:19
bulgin bulgin is offline
Junior Member
 
Join Date: Apr 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help and patience, Falko.

I found this link

http://article.gmane.org/gmane.comp....od-log-sql/330


which gives me the sql code necessary to construct the scoreboard table in the log file (no code for score_board, though, that I could find). I'm curious why the code to create this table is not included anywhere else in your instructions ? I had to search all over the internet to find this small snippet of code. Is it included in your instructions somewhere where I couldn't see it? In any event, now with the scoreboard table included some of the the errors are gone but I'm still getting these filling up my log with every request:

[Fri May 01 16:07:25 2009] [error] [client 255.254.132.134] File does not exist: /home/path/to/my/public_folder/d.ccm
[Fri May 01 16:07:25 2009] [error] mysql_query returned (1)
[Fri May 01 16:07:25 2009] [notice] db reconnect successful
[Fri May 01 16:07:25 2009] [error] mysql_query returned (1)
[Fri May 01 16:07:25 2009] [error] second attempt failed

and in the mysql logs:

090501 16:15:16 110 Query insert into web1_access_log (agent,bytes_sent,request_protocol,remote_host,req uest_method,referer$
110 Query insert ignore into scoreboard (domain,vhost,month,year,count_impressions) values ('www','default-$
110 Query update scoreboard SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+181 WHERE d$
110 Quit
115 Connect loguser@localhost on apachelogs
115 Query update scoreboard SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+181 WHERE d$
090501 16:15:17 116 Connect loguser@localhost on apachelogs
090501 16:15:31 117 Connect debian-sys-maint@localhost on
117 Quit
Reply With Quote
  #6  
Old 2nd May 2009, 21:23
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,752 Times in 2,582 Posts
Default

Quote:
Originally Posted by bulgin View Post
I'm curious why the code to create this table is not included anywhere else in your instructions ?
My tutorial was for Debian Etch, and you're using Ubuntu 8.04, so you cannot expect that the instructions work 100% on your system. They did for me on Debian Etch.


Quote:
Originally Posted by bulgin View Post
[Fri May 01 16:07:25 2009] [error] [client 255.254.132.134] File does not exist: /home/path/to/my/public_folder/d.ccm
[Fri May 01 16:07:25 2009] [error] mysql_query returned (1)
[Fri May 01 16:07:25 2009] [notice] db reconnect successful
[Fri May 01 16:07:25 2009] [error] mysql_query returned (1)
[Fri May 01 16:07:25 2009] [error] second attempt failed
Can you post an excerpt from the MySQL log from the same time (around Fri May 01 16:07:25 2009)?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian Etch with sa-exim & Clamav problem Diode Installation/Configuration 0 30th November 2008 22:44
Problem with OpenVZ On Debian Etch swap-as Installation/Configuration 2 24th August 2008 17:52
Problem installing debian etch /scripts/init-premount gral Installation/Configuration 3 18th January 2008 20:04
Debian Etch (Debian 4.0) apache2 file needed Dekalb Installation/Configuration 3 2nd June 2007 00:40
Mandriva 10.2 Perfect Setup Install Problems... ctroyp Installation/Configuration 12 30th December 2005 17:04


All times are GMT +2. The time now is 05:43.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.