SAP CPI Message Monitoring Logs Report
2023-12-8 15:46:59 Author: blogs.sap.com(查看原文) 阅读量:3 收藏

Step1: Create the Iflow with the desired name and connect the Sender and the integration process with the HTTP Adapter.

Step2: Add the Content Modifier with two properties LogStartDate, LogEndDate as shown in below image.

      Name                  Source Type                 Source Value                                                Data Type

LogEndDate                Expression         ${date:now:yyyy-MM-dd’T’HH:mm:ss.SSS}    java.lang.String

LogStartDate                  Xpath                              /Root/StartDate                                java.lang.String

Step3: Now add one Request reply and receiver with the OData V2 Adapter.

Do the following configurations in Connection and processing tab in the OData V2 Adapter.

Follow the below configuration to fetch the MPL logs from the MessageProcessingLogs API using OData V2 adapter.

In Connection tab: Address: https://<<TenentURL>>/odata/api/v1

Authentication: Basic

Credential Name:  (Deploy the CPI log Credentials with a particular name in the security Material in monitoring section as User credentials type).Give that particular name in the Credential Name field.

In Processing Tab:

Resource Path: MessageProcessingLogs

Query Option: $select=MessageGuid,CorrelationId,ApplicationMessageId,ApplicationMessageType,LogStart,LogEnd,Sender,Receiver,IntegrationFlowName,Status,AlternateWebLink,IntegrationArtifact,LogLevel,CustomStatus,TransactionId,PreviousComponentName&$filter=LogStart ge datetime’${property.LogStartDate}’ and LogEnd le datetime’${property.LogEndDate}’.

Step4: Add one Message Mapping element  and create Mapping as shown below.

After creating the Message Mapping Upload the Source and Target XSD files with below given xsd Codes.

Source XSD:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="MessageProcessingLogs">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="1" maxOccurs="unbounded" name="MessageProcessingLog">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xs:string" nillable="false" maxOccurs="unbounded" name="MessageGuid" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="CorrelationId" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="ApplicationMessageId" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="ApplicationMessageType" xmlns=""/>
                            <xs:element type="xs:dateTime" nillable="true" minOccurs="0" maxOccurs="unbounded" name="LogStart" xmlns=""/>
                            <xs:element type="xs:dateTime" nillable="true" minOccurs="0" maxOccurs="unbounded" name="LogEnd" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Sender" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Receiver" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="IntegrationFlowName" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Status" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="AlternateWebLink" xmlns=""/>
                            <xs:element nillable="false" maxOccurs="unbounded" name="IntegrationArtifact">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Id" xmlns=""/>
                                        <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Name" xmlns=""/>
                                        <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Type" xmlns=""/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="LogLevel" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="CustomStatus" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="TransactionId" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="PreviousComponentName" xmlns=""/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Target XSD:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="MessageProcessingLogs">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" name="MessageProcessingLog">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xs:string" nillable="false" maxOccurs="unbounded" name="IntegrationFlowName" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Completed" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Failed" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Processing" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Retry" xmlns=""/>
                            <xs:element type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" name="Escalated" xmlns=""/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

After uploading the XSD files do the following Mapping with all the elements in the Target XSD.

Step5: After Message Mapping add the XML to CSV Converter.

And give this Xpath (/MessageProcessingLogs/MessageProcessingLog) in the Path to the source element field in the Processing tab.

Step 6: After giving the Xpath Save and Deploy the iflow ,then fetch the endpoint URL’s from monitoring section.

Use the Postman Tool to test the Iflow as shown below. And in the Body section give the following xml payload with the Required StartDate.

Body in Postman:

<Root>

<StartDate>2023-11-13T9:15:00.000</StartDate>

</Root>

We can see the response in the csv format and can save the response to get as the CSV file.


文章来源: https://blogs.sap.com/2023/12/08/sap-cpi-message-monitoring-logs-report/
如有侵权请联系:admin#unsafe.sh