- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个 php worker,我将事件记录到 AWS 可以观看。不幸的是,我在尝试提交时遇到了以下错误。
InvalidSequenceTokenException Error executing "PutLogEvents" on "https://logs.eu-west-1.amazonaws.com"; AWS HTTP error: Client error:
POST https://logs.eu-west-1.amazonaws.com
resulted in a400 Bad
response: {"__type":"InvalidSequenceTokenException","expectedSequenceToken":"999999999999990356407851919528174 (truncated...) InvalidSequenceTokenException (client): The given sequenceToken is invalid. The next expected sequenceToken is: 495599999999988500356407851919528174642 - {"__type":"InvalidSequenceTokenException","expectedSequenceToken":"495573099999999900356407851919528174642","message":"The given sequenceToken is invalid. The next expected sequenceToken is: 495579999999900356407851919528174642"}
Request
这是我的代码
$date = new DateTime();
$instance= = new CloudWatchLogsClient([
'region' => 'eu-west-1',
'version' => 'latest',
'credentials' => [
'key' => 'XXX',
'secret' => 'XXXX'
]
]);
$instance->putLogEvents([
'logGroupName' => "WorkerLog",
'logStreamName' => "log",
'logEvents' => [
[
'timestamp' => $date->getTimestamp(),
'message' => "test log"
]
]
]);
最佳答案
http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
您必须在请求中包含一个序列标记。如果您没有,则必须使用 describeLogStreams ( http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogStreams.html ) 来获取流序列。
当您调用 putLogEvents 时,您将在响应中获得 nextToken。您还必须为其他人推送到流并使 nextToken 无效的情况做好准备。 (在这种情况下,您需要再次描述流以获取更新的 token )。
关于php - AWS-CloudWatch : InvalidSequenceTokenException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34525955/
我有一个 php worker,我将事件记录到 AWS 可以观看。不幸的是,我在尝试提交时遇到了以下错误。 InvalidSequenceTokenException Error executing
我是一名优秀的程序员,十分优秀!