I guess something along this should work. First, make sure you have the line below in your rsyslog conf file, so MySQL output module gets loaded:
$ModLoad ommysql
Then, filter the stuff you want like this:
:msg, contains, "Heroku" :ommysql:dbserver,dbname,dbuser,dbpass;heroku-template
Next you need to create a template for your data, so rsyslog knows what and how to insert to your database. Here is an example template which only records date and message, and is excepting you to have a table with only two columns, date
and message
.
$template heroku-template, "INSERT INTO herokulog(date,message) VALUES ('%timestamp','%msg')\r\n", SQL
Something like this should work. Note that this was on the top of my head and not tested at all, but you get the idea. Much more detailed information can be found from rsyslog web site, for example the available template parameter values might interest you.
There is a typo in the sql template, $msg% instead of %msg%; which rsyslog tried to tell me, and I even quoted in my original question.
Best Answer
You should install and setup logrotate. It will compress the old logs, rotating them on a time/size base.