Confirmed Postfix log parsing is working again.

This commit is contained in:
dmwilcox
2016-01-21 01:46:30 -08:00
parent c87b5d6a78
commit 7c6c3efb0f
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ class Config(BaseConfig):
labels = mx_hostname.split(".")
for n in range(1, len(labels)):
parent = "." + ".".join(labels[n:])
if parent in mx_to_domains_map:
if parent in mx_to_domain_map:
return mx_to_domain_map[parent]
return None
+5 -4
View File
@@ -3,7 +3,7 @@ import re
import sys
import collections
import Config as config
import Config
# TODO: There's more to be learned from postfix logs! Here's one sample
# observed during failures from the sender vagrant vm:
@@ -47,7 +47,8 @@ def get_counts(input, config):
seen_trusted = True
address_domains = config.get_address_domains(mx_hostname, mx_to_domain_mapping)
if address_domains:
d = ', '.join(address_domains)
domains_str = [ a.domain for a in address_domains ]
d = ', '.join(domains_str)
counts[d][validation] += 1
counts[d]["all"] += 1
elif deferred:
@@ -70,8 +71,8 @@ if __name__ == "__main__":
if len(sys.argv) != 2:
print "Usage: %s starttls-everywhere.json" % sys.argv[0]
sys.exit(1)
c = config.Config()
c.load_from_json_file(sys.argv[1])
config = Config.Config()
config.load_from_json_file(sys.argv[1])
(counts, tls_deferred) = get_counts(sys.stdin, config)
print_summary(counts)
print tls_deferred