diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/barcharter.py b/barcharter.py new file mode 100644 index 0000000..47f2ca4 --- /dev/null +++ b/barcharter.py @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import sys +skip_ips = ["93.97.158.26"] +html_template_head = """ + +
+ + + + + + + +""" +cols_html = """ + data.addColumn('string', 'Source'); + data.addColumn('number', 'Count');""" +row_html = """ + data.setValue(%d, 0, '%s'); + data.setValue(%d, 1, %d); +""" +data_html = "%(count)s, undefined, undefined" + +def get_data(file_handle): + name = file_handle.name.split("/")[-1].split(".")[0] + count = 0 + for row in file_handle.readlines(): + ip = row.split()[0] + if ip in skip_ips: + continue + count += 1 + skip_ips.append(ip) + return name, count + +def plot_data(sources): + html = html_template_head + html += cols_html + html += " data.addRows(%d);" % len(sources) + idx = 0 + for name, count in sources: + html += row_html % (idx, name, idx, count); + idx += 1 + html += html_template_foot + print html + +sources = [get_data(open(x, "r")) for x in sys.argv[1:]] +plot_data(sources) diff --git a/customlogcharter.py b/customlogcharter.py new file mode 100755 index 0000000..945cb95 --- /dev/null +++ b/customlogcharter.py @@ -0,0 +1,97 @@ +#!/usr/bin/python + +import sys +import re +from datetime import datetime, timedelta +skip_ips = ["93.97.158.26"] +html_template_head = """ + + + + + + + + + +