domainaware / parsedmarc

A Python package and CLI for parsing aggregate and forensic DMARC reports
https://domainaware.github.io/parsedmarc/
Apache License 2.0
961 stars 209 forks source link

Add GELF support #532

Open lingfish opened 1 week ago

lingfish commented 1 week ago

Implement the ability to log to a GELF server/input, via the use of pygelf.

This is my initial stab at it; similar to SyslogClient, I opted to use parsed_aggregate_reports_to_csv_rows.

This is all sent in one field to GELF (parsedmarc), where then it is normal practice to split the sub-fields out within your logging app (eg. Graylog).

This would be an example Graylog pipeline rule:

rule "DMARC GELF"
when
  has_field("parsedmarc")
then
  let json = parse_json(to_string($message.parsedmarc));
  let map = to_map(json);
  set_fields(map, "dmarc_");
end
codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 59.98%. Comparing base (d6128ea) to head (fdfb92b). Report is 24 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #532 +/- ## ========================================== + Coverage 59.88% 59.98% +0.10% ========================================== Files 12 12 Lines 1578 1577 -1 ========================================== + Hits 945 946 +1 + Misses 633 631 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.