意外的响应状态:访问X-Amz-Target时为401:AWS中的Logs_20181106.GetLogEvents

时间:2018-11-08 09:13:36

标签: amazon-web-services amazon-cloudwatchlogs

我想执行GetLogEvents API并使用Java代码获取日志。以下是我使用过的示例参考代码Sample Reference code

执行过程中,我得到以下错误代码 pagestruct crossid @date(dateid)

以下是AWS API详细信息链接:GetLogEvents API Post url

这是发布请求中传递的详细信息(详细信息已被屏蔽):

规范请求:

org.apache.http.client.ClientProtocolException: Unexpected response status: 401

要签名的字符串:

AWS4-HMAC-SHA256 20181108T084728Z 20181108 / ap-south-1 / logs / aws4_request XXX5ui890cXXX7d2f6944726317ea21ccXXXX

签名:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

标题:

x-amz-date = 20181108T084728Z 授权= AWS4-HMAC-SHA256凭证= accessKey / 20181108 / ap-south-1 / logs / aws4_request,SignedHeaders = host; x-amz-date,Signature = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

这是我根据需要更新的代码:

POST
Action=Logs_20140328.GetLogEvents

host:logs.ap-south-1.amazonaws.com/
x-amz-date:20181108T084728Z

host;x-amz-date
XXXXXea1ebe988765z8e1f41c2d9983d96784aXXXXX

注意:应用登录是使用多重身份验证访问代码(Authy)配置的

0 个答案:

没有答案