首页 > 解决方案 > 如何在 Cloudwatch 中屏蔽 AWS SNS SMS 传递状态日志中的数据

问题描述

我已经为 SNS 中的 SMS 消息设置了传递状态日志记录,它目前打印出云到 cloudwatch,如下所示:

{
    "notification": {
        "messageId": "0a90c123-7cf8-443f-bd1b-f3fd7e82d28c",
        "timestamp": "2021-04-01 00:45:03.606"
    },
    "delivery": {
        "phoneCarrier": "some random phone carrier",
        "mnc": 2,
        "numberOfMessageParts": 1,
        "destination": "+01234567890",
        "priceInUSD": 0.0345,
        "smsType": "Transactional",
        "mcc": 505,
        "providerResponse": "Unknown error attempting to reach phone",
        "dwellTimeMs": 276,
        "dwellTimeMsUntilDeviceAck": 5921
    },
    "status": "FAILURE" 
}

有没有办法可以屏蔽某些字段,例如手机号码,使其显示如下:

{
    "notification": {
        "messageId": "0a90c123-7cf8-443f-bd1b-f3fd7e82d28c",
        "timestamp": "2021-04-01 00:45:03.606"
    },
    "delivery": {
        "phoneCarrier": "some random phone carrier",
        "mnc": 2,
        "numberOfMessageParts": 1,
        "destination": "*********890",
        "priceInUSD": 0.0345,
        "smsType": "Transactional",
        "mcc": 505,
        "providerResponse": "Unknown error attempting to reach phone",
        "dwellTimeMs": 276,
        "dwellTimeMsUntilDeviceAck": 5921
    },
    "status": "FAILURE" 
}

标签: amazon-cloudwatchamazon-snsamazon-cloudwatchlogs

解决方案


推荐阅读