diff options
Diffstat (limited to 'monitor/josef_logreader.py')
| -rwxr-xr-x | monitor/josef_logreader.py | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/monitor/josef_logreader.py b/monitor/josef_logreader.py index 5f6f768..2b3a473 100755 --- a/monitor/josef_logreader.py +++ b/monitor/josef_logreader.py @@ -5,6 +5,7 @@ import sys import time import datetime import os +import json from monitor_conf import * @@ -96,18 +97,38 @@ def print_errors(l): break # comment this line to print all errors ever pass +def print_overlap(l): + log = read_loglog(l) + entry_count = {} + total = 0 + for line in log: + # line = item[TIME_LEN:] + logs = json.loads(line.split("logs: ")[-1][:-1].replace("'", '"')) + for l in logs: + if l in entry_count: + entry_count[l] += 1 + else: + entry_count[l] = 1 + total += 1 + + # print entry_count + for e in entry_count: + print e + ", " + str(entry_count[e]) + " (" + str(int(100 * float(entry_count[e])/float(total))) + "%)" if __name__ == "__main__": + OVERLAP_STR = "_overlap.log" logs = get_logs() for log in logs: if log == "monitor.log": pass - else: - print log - print_log_stats(log) - print_average_age(log) - print_errors(log) - print "" + elif log[- len(OVERLAP_STR):] == OVERLAP_STR: + print_overlap(log) + # else: + # print log + # print_log_stats(log) + # print_average_age(log) + # print_errors(log) + # print "" |
