Welcome to WebmasterWorld Guest from 54.145.136.73

Forum Moderators: open

Home made logging? Unwise?

mysql log

   
8:52 pm on Jul 27, 2010 (gmt 0)

10+ Year Member



I am on shared hosting, and run a small e-commerce site that is database driven (mysql).

Since I am on shared hosting, I have no access to the mysql logs. More than several times I've accidentally deleted or changed something and had to go through old backups to restore it. So I thought about creating my own log .. something along the lines of a function i.e.

function runsql($command) {
$response = mysql_query($command);
$log = "INSERT into homemadelog ('key','command','added') values ('','$x',NOW());";
$y = mysql_query($log);
}

I know this is a hard question to answer, but I'm wondering whether this will overload the server in any way? Some pages use mysql more than others, but some of the popular pages have probably 10-20 query's. This would in effect double that.
1:36 am on Jul 29, 2010 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



>> More than several times I've accidentally deleted or changed something and had to go through old backups to restore it

I don't see how keeping a log of this nature helps you with this problem. Perhaps you could explain? Do you keep backups of the file system as well? Do you use version control software? All things to think about.

I personally thing logging every query is not necessary. Especially since you now have to go back and modify your entire CMS every time you query the tables. If you are worried about security issues then you should only use a user id that has privileges to the specific things it needs to do to the tables it needs to do them. Most of the time this is SELECT, and ever so often an UPDATE or DELETE.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month