The log buffer writes redo log information to ib_logfile0 and ib_logfile1 for transactional purposes only. There is nothing text readable within those files.
The file /var/log/mysqld.log is the main error-logging mechanism built in mysql. Anything additional would probably be in /var/log/messages.
You could use the general log. In fact, you should try using the MySQL table version of the general log.
If you run this:
SHOW CREATE TABLE mysql.general_log\G
You should see something like this:
mysql> show create table mysql.general_log\G
*************************** 1. row ***************************
Table: general_log
Create Table: CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
1 row in set (0.14 sec)
mysql>
The user_host
column will record the MySQL user and the IP Address/DNS Name the command came from.
You are probably saying right now, "That table is a CSV file. I would have to parse it." That's true, you would have to. However, did you know that you can convert it to a MyISAM table? I have actually tried this out for one of my employer's DB Hosting Clients, and I wrote a post explaining it (See the Feb 24, 2011
post down below).
Here are the basic steps:
Make the mysql.general_log table MyISAM
Run the following:
CREATE TABLE mysql.general_log_original LIKE mysql.general_log;
ALTER TABLE mysql.general_log ENGINE=MyISAM;
ALTER TABLE mysql.general_log ADD INDEX (event_time);
Enable the general log
Add the following to /etc/my.cnf
[mysqld]
log-output=TABLE
general-log
If you also want the text version of the general log, add this:
[mysqld]
log-output=TABLE,FILE
general-log
general-log-file=/var/log/mysql_general.log
Restart mysql
Simply run service mysql restart
I have many posts about using the general log and the slow log as MyISAM tables:
CAVEAT
MySQL 5.5.28 has recently introduced the audit log plugin and how to install it.
Here are the options
These are new to me so I have nothing pros or cons at this time on the Audit Log Plugin.
Best Answer
If you are willing to upgrade to MySQL 5.5, there is a way to store the general log as a MyISAM table. I have written about this before in past articles:
Feb 24, 2011
: Audit logins on MySQL databaseJun 30, 2011
: How do I output MySQL logs to syslog?Feb 11, 2012
: MySQL general logSince you are using MySQL 5.0.91, you cannot configure the general log to be stored as a MyISAM table. You can only do so as a text file. Nevertheless, there have been other contributors in the DBA StackExchange that have suggested very good ideas for the text file version of the general log in your quest to audit DB Logins for MySQL 5.0. These suggestions may be more what you are looking for:
Aug 26, 2011
: How do I output MySQL logs to syslog? from @JoelHangerNov 16, 2011
: Log MySQL DB changing queries and users from @DTest