Logging only mySQL logins on heavily used system I have an audit requirement where they want all database access (logins) logged.  We have a very large distributed system of hundreds of mySQL servers (shards, slaves, slaves of slaves) that are serving a thousand queries per second.  As a result, I can't just turn on general query logging as recommended in Audit logins on MySQL database, it'll be multiple GB/day per instance and kill our disk IO. 

I've looked and see two options to do discretionary logging with filtering - an Oracle plugin and a McAfee plugin.  The Oracle one requires you to be paying them $ for enterprise mySQL, and with hundreds of db servers I'm not really prepared to start doing that today.  The McAfee one is brand new and I'm worried about stability on a large scale system like we have.

Any other good solutions to log only logins to our mySQL databases?  It doesn't have to be integral to mySQL, we'd consider UNIX level port sniffing shenanigans if they'd scale.
I really wish I could take credit for this, but I can't.  I chanced across this while thinking about your question: 

http://www.fromdual.com/mysql-logon-and-logoff-trigger-for-auditing

It never occurred to me to call a stored procedure from init_connect... but I (somewhat enthusiastically, I might add) tested this solution before posting it here, and found that it works exactly as described, on off-the-shelf MySQL 5.5.30.  

It logs every login of every user who lacks the SUPER privilege.  This is a bit of a limitation, except, of course, for the fact that a SUPER user could manipulate the audit table anyway.  

To capture the logouts with similar logic, you have to modify the server source, since init_connect does not have a built-in counterpart that gets executed at the end of the session.