in reply to
Malformed UTF-8 character Error
Sorry if my questioning is a bit off-topic, but have you looked at possible solutions for what you're after in the first place in the 'qmail-world' ?
A short google search after 'qmail log' brings a lot of links; one of the first ones is
Working with qmail's log files which points to a few useful scripts, like mtrack, strack or convert-multilog.
There might be others too; might be that one of those it as least a good starting point ?
Just an idea, maybe it helps too.