Optimize batch sending of log messages