diff options
| author | josef <josef.gson@gmail.com> | 2015-10-19 13:51:45 +0200 |
|---|---|---|
| committer | josef <josef.gson@gmail.com> | 2015-10-19 13:51:45 +0200 |
| commit | 833f64c2621b8cef3ec350d530541498d7173dbc (patch) | |
| tree | 32812e96bd575540f2f0542967e8b0387df17cce /monitor/josef_logreader.py | |
| parent | e432e62cc2ae7c7cbe7639eb476939ddc27afb85 (diff) | |
adding code for analyzing overlap
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 "" |
