SAP ALM Integration & API: How to use the SAP Cloud ALM Raw Logs Data API for Exception Monitoring
2023-11-21 16:25:40 Author: blogs.sap.com(查看原文) 阅读量:10 收藏

In this series of articles, we will focus on the SAP Cloud ALM Raw Data API.

The SAP Cloud ALM raw data API implements the OpenTelemetry protocol to provide access to the observability signals produced by SAP Cloud ALM.

In the previous post we introduced the SAP Cloud ALM Raw Data Metrics API.

In this blog, we will illustrate how to use this API to export and import logs managed by the SAP Cloud ALM Exception monitoring use case.

Get System Information

From the Landscape Management SAP Cloud ALM application

Find the system information to identify the system ID as shown below:

Check the list of logs reported for your system

From the Exception Monitoring SAP Cloud ALM application, select the system containing the logs you want to export:

You will find the list of logs reported for your system:

Export the logs datasets via SAP Cloud ALM raw data logs outbound API

From an HTTP client, access to the following URL:

GET https://{{HOST}}/api/calm-logs/v1/logs?format=protobuf-json&serviceId=99e47386-ebaa-4c8e-bab8-dca096a7dd24&provider=exm.im&limit=2&period=30M

Parameters

Parameters Value
provider exm for exception monitoring
serviceId Set the serviceId of your system
format protobuf-json
limit
period

Check the SAP Business Accelerator HUB for a complete list of parameters.

Output

The output payload contains the list of logs in protobuf-json.

{
    "resourceLogs": [
        {
            "resource": {
                "attributes": [
                    {
                        "key": "service.name",
                        "value": {
                            "stringValue": "QM7002"
                        }
                    },
                    {
                        "key": "sap.service.display_name",
                        "value": {
                            "stringValue": "QM7 (QM7002)"
                        }
                    },
                    {
                        "key": "service.instance.id",
                        "value": {
                            "stringValue": "312733191"
                        }
                    },
                    {
                        "key": "service.namespace",
                        "value": {
                            "stringValue": "SAP_S4HANA_OP"
                        }
                    },
                    {
                        "key": "telemetry.sdk.name",
                        "value": {
                            "stringValue": "sap.calm"
                        }
                    },
                    {
                        "key": "telemetry.sdk.version",
                        "value": {
                            "stringValue": "1.0.0"
                        }
                    },
                    {
                        "key": "telemetry.sdk.language",
                        "value": {
                            "stringValue": "java"
                        }
                    }
                ]
            },
            "scopeLogs": [
                {
                    "scope": {
                        "name": "default"
                    },
                    "logRecords": [
                        {
                            "timeUnixNano": "1695654385000000000",
                            "severityNumber": "SEVERITY_NUMBER_ERROR",
                            "severityText": "Error",
                            "body": {
                                "stringValue": "Logon of user in client 002 failed when starting a step"
                            },
                            "attributes": [
                                {
                                    "key": "sap.exm.category",
                                    "value": {
                                        "stringValue": "ABAP Aborted Job"
                                    }
                                },
                                {
                                    "key": "sap.exm.correlationId",
                                    "value": {
                                        "stringValue": "SENTIMENT ASSIGNMENT@17042701"
                                    }
                                },
                                {
                                    "key": "Subcategory",
                                    "value": {
                                        "stringValue": "SENTIMENT ASSIGNMENT"
                                    }
                                }
                            ],
                            "observedTimeUnixNano": "1695654605862000000"
                        },

Import the logs datasets via SAP Cloud ALM raw data logs inbound API

From an HTTP client, access to the following URL:

POST https://{{HOST}}//api/calm-logs/v1/logs?format=protobuf-json&serviceId=6424348e-4a39-41b5-b9d1-26d7cb2c09d1&useCase=exm.im

Parameters

Query

Parameters Value
serviceId Set the serviceId of the target system
format protobuf-json
useCase exm.im to inject the exception in the Integration Monitoring use-case

Check the SAP Business Accelerator HUB for a complete list of parameters.

Body

Attach the payload exported in the previous operation or any Open Telemetry logs compatible content.

Validate the result in SAP Cloud ALM

From the Exception Monitoring SAP Cloud ALM application, check the result in the exception monitoring application by selecting your target system.

You should see the imported logs entries attached to your system.

Navigate to the Exceptions view to get the details.

In the next article, we will look into the SAP Cloud ALM raw data traces API.

Thanks for reading.


文章来源: https://blogs.sap.com/2023/11/21/sap-alm-integration-api-how-to-use-the-sap-cloud-alm-raw-logs-data-api-for-exception-monitoring/
如有侵权请联系:admin#unsafe.sh