'Get <num_entries> of the cinder syslog events.'

@args('num_entries', nargs='?', type=int, default=10, help='Number    of    entries    to    list    (default:    %(default)d)')
def syslog(self, num_entries=10):

    entries = int(num_entries)
    count = 0
    log_file = ''
    if os.path.exists('/var/log/syslog'):
        log_file = '/var/log/syslog'
    elif os.path.exists('/var/log/messages'):
        log_file = '/var/log/messages'
    else:
        print(_('Unable    to    find    system    log    file!'))
        sys.exit(1)
    lines = [line.strip() for line in open(log_file, 'r')]
    lines.reverse()
    print((_('Last    %s    cinder    syslog    entries:-') % entries))
    for line in lines:
        if (line.find('cinder') > 0):
            count += 1
            print((_('%s') % line))
        if (count == entries):
            break
    if (count == 0):
        print(_('No    cinder    entries    in    syslog!'))
