I'm working on Nagios plugin to monitor our rsyslog server, which is back-ended into a MySQL database. The plugin operates by generating a unique string, sending it to syslog, and then querying the MySQL DB for the unique string, hence proving that the service is correctly receiving and storing messages.
The table is, unsurprisingly, big (~3.5 million rows, 2.1GB on disk), and in InnoDB format. The column holding the syslog messages is of type LONGTEXT.
I'm currently sending it queries of the form:
SELECT count(*) FROM allremote WHERE message LIKE '%check_rsyslogdb_1328869942%';
Where in this case check_rsyslogdb_1328869942
is the unique string logged by the plugin.
Is there a more efficient way for me to approach this query?
I looked into FULLTEXT indexes, but they are MyISAM only, and as a policy we avoid MyISAM because, it is, apparently, inferior.