@@ -0,0 +1,1934 @@
+#!/usr/bin/env python%0A%0Afrom optparse import OptionParser%0Aimport re%0A%0A# For an individual pod, check that each message id occurs once.  None missing, no duplicates%0Adef verify(expected,actual) :%0A    missing = 0%0A    duplicates = 0%0A%0A    for i in range(1, expected+1) :%0A        key = str(i)%0A        if not key in actual :%0A            print %22MISSING: %22 + key%0A            missing += 1%0A        elif actual%5Bkey%5D %3E 1 :%0A            print %22DUPLICATE: %22 + key + %22: COUNT=%22 + str(actual%5Bkey%5D)%0A            duplicates += 1%0A%0A    if (missing %3E 0) or (duplicates %3E 0):%0A        verdict = %22PROBLEM: missing=%22 + str(missing) + %22 duplicates=%22 + str(duplicates)%0A    else:%0A        verdict = %22OK%22%0A%0A    return verdict%0A%0A%0Aif __name__ ==  %22__main__%22:%0A    parser = OptionParser()%0A    parser.add_option(%22-f%22, dest=%22file%22, help=%22file containing elasticsearch or rsyslog dump%22)%0A    parser.add_option(%22-n%22, dest=%22expected%22, type=%22int%22, default=100, help=%22expected number of messages%22);%0A%0A    (options, args) = parser.parse_args()%0A    expected = options.expected%0A    in_file = options.file%0A%0A    pod_counts = %7B%7D%0A%0A#   %22message%22 : %222018-05-21 18:58:44,927 - SVTLogger - INFO - centos-logtest-bfkrm : 114 : HMhHxeSqV 6FHJrLGc7 7vSoNd4Kr ....%0A    message_id_regex = re.compile(%22.*SVTLogger - INFO - (centos-logtest-%5Ba-z0-9%5D%7B5%7D) : (%5Cd+)%22)%0A%0A    with open(in_file,'r') as f:%0A        for line in f:%0A            result = message_id_regex.search(line)%0A            if result != None:%0A                pod_name = result.group(1)%0A                id = result.group(2)%0A%0A                if not pod_name in pod_counts:%0A                    pod_counts%5Bpod_name%5D = %7B%7D%0A%0A                if not id in pod_counts%5Bpod_name%5D :%0A                    pod_counts%5Bpod_name%5D%5Bid%5D = 1%0A                else :%0A                    pod_counts%5Bpod_name%5D%5Bid%5D += 1%0A        f.close()%0A%0A    for pod in pod_counts:%0A        print %22Verify pod: %22 + pod%0A        print %22Verdict: %22 + verify(expected,pod_counts%5Bpod%5D) + %22%5Cn%22%0A%0A%0A

Add utility to verify logs from the ocp_logtest tool (#456)