tierpod / dmarc-report-converter

Convert dmarc reports from xml to human-readable formats
MIT License
237 stars 25 forks source link

Add a merge_key configuration option #57

Closed moorereason closed 5 months ago

moorereason commented 5 months ago

Add a merge_key configuration option to allow for custom merge matching logic.

Updates #43

moorereason commented 5 months ago

To give an example of how I use this: I tend to hack on this project and basically always have input.delete=no so that I can test changes/patches. I don't currently have this process scheduled via cron. I just run it every week or so when I have time to look at the results.

I'm using the following settings with this patch to get per-day, merged reports for each reporting org:

input:
  delete: no

output:
  file: "html/{{ .PolicyPublished.Domain }}/{{.ReportMetadata.DateRange.Begin.UTC.Format \"2006-01-02\" }}/{{ .ReportMetadata.OrgName }}.html"

merge_reports: yes
merge_key: "{{ .ReportMetadata.OrgName }}!{{ .ReportMetadata.Email }}!{{ .PolicyPublished.Domain }}!{{ .ReportMetadata.DateRange.Begin }}"

(My config has more settings than this--I'm showing the relevant parts here.)

Notice that I put the DateRange.Begin in the output path and the merge key. These settings need to work together or you'll overwrite the same file path and miss results.

So, I could see this feature being very useful for people like me but also confusing if you don't watch what you're doing.

tierpod commented 5 months ago

Agree, this setting can be a little confusing. As long as it doesn't break previous behavior with defaults, we can keep it for advanced usage, like you described. Thanks a lot!