mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-02-17 07:03:58 +00:00
* fix smtptls and forensic reports for GELF * add policy_domain, policy_type and failed_session_count to record row * Remove unused import of json in gelf.py --------- Co-authored-by: Sean Whalen <44679+seanthegeek@users.noreply.github.com>
This commit is contained in:
@@ -595,9 +595,18 @@ def parsed_smtp_tls_reports_to_csv_rows(
|
||||
if "mx_host_patterns" in policy:
|
||||
record["mx_host_patterns"] = "|".join(policy["mx_host_patterns"])
|
||||
successful_record = record.copy()
|
||||
successful_record["policy_domain"] = policy[
|
||||
"policy_domain"
|
||||
]
|
||||
successful_record["policy_type"] = policy[
|
||||
"policy_type"
|
||||
]
|
||||
successful_record["successful_session_count"] = policy[
|
||||
"successful_session_count"
|
||||
]
|
||||
successful_record["failed_session_count"] = policy[
|
||||
"failed_session_count"
|
||||
]
|
||||
rows.append(successful_record)
|
||||
if "failure_details" in policy:
|
||||
for failure_details in policy["failure_details"]:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import logging.handlers
|
||||
import threading
|
||||
@@ -62,9 +61,11 @@ class GelfClient(object):
|
||||
def save_forensic_report_to_gelf(self, forensic_reports: list[dict[str, Any]]):
|
||||
rows = parsed_forensic_reports_to_csv_rows(forensic_reports)
|
||||
for row in rows:
|
||||
self.logger.info(json.dumps(row))
|
||||
log_context_data.parsedmarc = row
|
||||
self.logger.info("parsedmarc forensic report")
|
||||
|
||||
def save_smtp_tls_report_to_gelf(self, smtp_tls_reports: dict[str, Any]):
|
||||
rows = parsed_smtp_tls_reports_to_csv_rows(smtp_tls_reports)
|
||||
for row in rows:
|
||||
self.logger.info(json.dumps(row))
|
||||
log_context_data.parsedmarc = row
|
||||
self.logger.info("parsedmarc smtptls report")
|
||||
|
||||
Reference in New Issue
Block a user