|We don't bite newbies here... much
Why not share the names of the culprit software(s)? I mean, if they are open source and written in a language somebody else knows, perhaps they can see where a couple of C-type calls could be made to do what you want.
Otherwise, doing what you're doing will be fine; just run a DNS cache alongside your application/module, check/cache the result, then tee off to a custom log file as you said.
That, or write a log parser instead, that either rewrites the log file when you want to read it, or one that reads line-by-line and displays to the consumer after the transformation has occurred.
Perhaps stating your overall objective would be handy here to get more appropriate feedback.