我正在使用 Aws SNS 发送通知,并将通知发送到不同的主题,并且运行良好。
当我publish
通知时,我得到了像
object(Aws\Result)#84 (1) {
["data":"Aws\Result":private]=>
array(2) {
["MessageId"]=>
string(36) "************-7a29-591f-8765-************"
["@metadata"]=>
array(4) {
["statusCode"]=>
int(200)
["effectiveUri"]=>
string(40) "https://sns.ap-southeast-1.amazonaws.com"
["headers"]=>
array(4) {
["x-amzn-requestid"]=>
string(36) "************-b737-5831-abf4-************"
["content-type"]=>
string(8) "text/xml"
["content-length"]=>
string(3) "294"
["date"]=>
string(29) "Fri, 28 Oct 2016 08:59:05 GMT"
}
["transferStats"]=>
array(1) {
["http"]=>
array(1) {
[0]=>
array(0) {}
}
}
}
}
}
我在服务器端使用 php,
但是我需要为每个主题分别生成一个报告,哪些端点(主题的订阅者)收到通知以及通知是否失败,以及成功传递的百分比是多少。
经过大量研究,我发现 Aws CloudWatch 可以完成我的工作,我也在 stackOverflow 上搜索了这个,得到了这个答案:
我还在 CloudWatch 中生成了一些日志,通过describeLogGroups
,我得到了类似的数组
[logGroups] => Array(
[0] => Array
(
[logGroupName] => sns/ap-southeast-1/************/app/GCM/AndroidN
[creationTime] => ************
[retentionInDays] => 30
[metricFilterCount] => 0
[arn] => arn:aws:logs:ap-southeast-1:************:log-group:sns/ap-southeast-1/************/app/GCM/AndroidN:*
[storedBytes] => 3133
)
)
通过describeLogStreams
,我得到了像
[logStreams] => Array(
[0] => Array
(
[logStreamName] => 25
[creationTime] => 1477574852344
[firstEventTimestamp] => 1477574831966
[lastEventTimestamp] => 1477574831966
[lastIngestionTime] => 1477574852374
[uploadSequenceToken] => ***********************8
[arn] => arn:aws:logs:ap-southeast-1:*********:log-group:sns/ap-southeast-1/**********/app/GCM/AndroidN:log-stream:25
[storedBytes] => 627
)
)
但对如何访问特定主题感到困惑,因为在我的网站中,我为用户组(端点)创建了一些主题,现在我想为每个主题显示有多少通知发送/失败到端点而不是主题,
感谢预期。