MySQL Forums
Forum List  »  Newbie

Re: filter type when generalting general_log into table
Posted by: Aftab Khan
Date: June 24, 2012 12:25PM

>Is't possible to enable general_log, but only log those actions about CONNECT?

I am afraid this isn't possible, 'general log' captures everything that is sent to the MySQL server, however, you can query 'mysql.general_log.' table to extract required information, for example:

mysql> SELECT * FROM mysql.general_log WHERE command_type='Connect';

but I would convert general_log table storage engine to 'myisam' and add index on 'command_type' column:

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,
KEY `command_type` (`command_type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log';

If space is an issue, you can disable 'general log' at anytime e.g. SET general_log=[1/0]; Alternatively you can purge older records but this may impact on your database performance. How long do you need general log enabled for ?

Options: ReplyQuote


Subject
Written By
Posted
Re: filter type when generalting general_log into table
June 24, 2012 12:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.