I'm trying to parse parsedmarc json files. These log files contain a single array with multiple records. I've taken the json and am testing with a single record, and am struggling to find the right combination of filebeat and processor configuration.
If I configure json interpreter it trips over the array, but if I use decode_json_fields I'm not getting the fields interpreted either.
The configuration I'm currently testing with:
#Processors:
decode_json_fields:
fields: ["xml_schema", "policy_published", "records"]
process_array: true
max_depth: 4
target: ""
overwrite_keys: true
add_error_key: true
#Custom configurations:
multiline:
pattern: '^['
negate: true
match: after
But whatever I do, I get either one document per line as clear text or the entire array.
The input json I'm testing with:
[
{
"xml_schema": "1.1",
"report_metadata": {
"org_name": "outlook.com",
"org_email": "dmarcreport@microsoft.com",
"org_extra_contact_info": null,
"report_id": "89c0dced65764e6ea0a60a85671b4042",
"begin_date": "2023-10-18 02:00:00",
"end_date": "2023-10-19 02:00:00",
"errors": []
},
"policy_published": {
"domain": "example.com",
"adkim": "r",
"aspf": "r",
"p": "none",
"sp": "none",
"pct": "100",
"fo": "1"
},
"records": [
{
"source": {
"ip_address": "188.172.137.13",
"country": "IE",
"reverse_dns": "outbyoip13.pod17.euw1.zdsys.com",
"base_domain": "zdsys.com"
},
"count": 1,
"alignment": {
"spf": true,
"dkim": false,
"dmarc": true
},
"policy_evaluated": {
"disposition": "none",
"dkim": "fail",
"spf": "pass",
"policy_override_reasons": []
},
"identifiers": {
"envelope_from": "example.com",
"header_from": "example.com",
"envelope_to": "hotmail.fr"
},
"auth_results": {
"dkim": [
{
"domain": "zendesk.com",
"selector": "zendesk1",
"result": "pass"
}
],
"spf": [
{
"domain": "example.com",
"scope": "mfrom",
"result": "pass"
}
]
}
}
]
}
]
But what I get back is either of:
Or the message field contains the entire json array in a single line. Neither gives me an interpreted index of the messages from the log file.
The above json contains one dmarc report, parsedmarc writes reports to the file by adding them to the main array.