The %hostname% from a MT is messed up and gives you <facility,severity> instead. Replace %HOSTNAME% with %fromhost% as a work around, it wont give you the DNS hostname but it will at least give you an IP address.
Here is a link that has all the available properties used with rsyslog
http://www.rsyslog.com/doc/property_replacer.html
Here is my template from my rsyslog.conf file:
$template TikRouters,"insert into TikRouters (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag, EventID) values ('%msg%', %syslogfacility%, '%fromhost%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%', '%msgid%')",SQL
if ($fromhost-ip == '<routerip>') then
mmysql:127.0.0.1,<database-name>,<username>,<password>;TikRouters
I know this caused me some frustration for quite some time, and I hope that my solution helps someone else. If anyone finds a better solution I would be more than happy to hear it/use it.