'Log all of the new data in the system log.'

def _log_messages(self, logdir):

    try:
        logpaths = ['/var/log/messages', '/var/log/syslog']
        for logpath in logpaths:
            if os.path.exists(logpath):
                break
        else:
            raise ValueError(('System    log    file    not    found    (looked    for    %s)' % logpaths))
        bytes_to_skip = 0
        if hasattr(self, '_messages_size'):
            current_inode = os.stat(logpath).st_ino
            if (current_inode == self._messages_inode):
                bytes_to_skip = self._messages_size
        in_messages = open(logpath)
        out_file_basename = (os.path.basename(logpath) + '.gz')
        out_file_name = os.path.join(logdir, out_file_basename)
        out_messages = gzip.GzipFile(out_file_name, 'w')
        try:
            in_messages.seek(bytes_to_skip)
            while True:
                in_data = in_messages.read(200000)
                if (not in_data):
                    break
                out_messages.write(in_data)
        finally:
            out_messages.close()
            in_messages.close()
    except ValueError as e:
        logging.info(e)
    except (IOError, OSError):
        logging.info('Not    logging    %s    (lack    of    permissions)', logpath)
    except Exception as e:
        logging.info('System    log    collection    failed:    %s', e)
