This is clear to me. What is not clear is, what is wrong with the previous unlink function?

In the new function there is code looking for rotated files but this seems out of the scope of standard process clean-up. It should not know anything about logrotated files and, even less, trying to remove those files.

Is there anything I am missing?