Including complex content in the event payload of a monitoring event
You can include parts of a message assembly in a monitoring event, by configuring an XPath expression in the event payload of a monitoring event.
Most events contain data that is taken from fields in the message tree or from elsewhere in the message assembly. You specify the Data location in the Event Payload section of the Monitoring Event editor.
If the configured XPath in the Data Location of the Event
Payload resolves to a simple element (
"name:value"
), the monitoring
event includes a "simpleContent"
section. For example, with an XPath
"$Root/DFDL/CSV/header/head_field2"
, where "head_field2"
is a
simple string element, the monitoring event formatted in JSON could contain the following code:
"applicationData": {
"simpleContent": [{
"elementName": "head_field2",
"elementValue": "h2",
"elementDataType": "string"
}],
If the configured XPath in the Data Location of the Event
Payload resolves to a complex element (a sub-tree), the monitoring event includes a
"complexContent"
section. For example, with an XPath
"$Root/DFDL/CSV/record[1]"
, where"record"
is a complex element
that has child elements, the monitoring event formatted in JSON could contain the following:
"applicationData": {
"complexContent": [{
"elementName": "record",
"elementValue": {
"bitstream": {
"field1": "Field1Val",
"field2": "Field2Val"
}
}
}]
If the configured XPath in the Data Location of the Event
Payload resolves to a repeating simple or complex element, there is a
"simpleContent"
or "complexContent"
section for each instance.
If an XPath query ends in a wildcard, each element node or attribute node appears in a separate
complexContent
or simpleContent
folder in the emitted event.
If required, you can configure the Data Location of the Event
Payload to resolve to a complex element in a message assembly that is in a message domain that does not match the format of the monitoring event.
For example, the XPath in the Data Location could be
"$Root/XML/...
"
and the monitoring event format could be JSON, or the XPath in the Data
Location could be "$Root/DFDL/... "
and the monitoring event format
could be JSON or XML. However, if the message domain of the complex element and the format of the
monitoring event are different, consider the following points:- XML monitoring event format:
- The names of elements resolved by the Event Payload Data Location XPath must be valid XML element names.
- MRM XML attributes become elements in the monitoring event. The resolved element must not have an attribute and a child element with the same name.
- JSON monitoring event format:
- The names of elements resolved by the Event Payload Data Location XPath must be valid JSON key fields.
- XMLNSC, XMLNS, and MRM attributes become JSON fields. The resolved element must not have an attribute and a child element with the same name.
- If the resolved element has a child element that repeats, the JSON monitoring event will have an object with repeating keys, which might lead to a "duplicate key" error.