了解AWS Lambda CloudWatch日志

时间:2016-07-24 04:23:24

标签: python lambda amazon-cloudfront cloudwatch

我正在使用AWS Lambda和Python,当发生错误时,我的日志中会出现奇怪的垃圾。有人知道这是什么吗?

我的堆栈是带有Zappa框架https://github.com/Miserlou/Zappa的AWS Lambda,Flask和Python 2.7。

<trimmed>
dklIL2ZsYXNrL2ZsYXNrL2FwcC5weSIsIGxpbmUgMTQ3NSwgaW4gZnVsbF9kaXNwYXRjaF9yZXF1ZXN0
PGJyIC8+ICBGaWxlICIvcHJpdmF0ZS92YXIvZm9sZGVycy8xai81emN4anpreDI5Yjh0ZmdyaDJ5OTB3
dDgwMDAwZ24vVC9waXAtYnVpbGQtdjZYdklIL2ZsYXNrL2ZsYXNrL2FwcC5weSIsIGxpbmUgMTQ2MSwg
aW4gZGlzcGF0Y2hfcmVxdWVzdDxiciAvPiAgRmlsZSAiL3ByaXZhdGUvdmFyL2ZvbGRlcnMvMWovNXpj
eGp6a3gyOWI4dGZncmgyeTkwd3Q4MDAwMGduL1QvcGlwLWJ1aWxkLWp2RVlXSS9mbGFzay1yZXN0ZnVs
L2ZsYXNrX3Jlc3RmdWwvX19pbml0X18ucHkiLCBsaW5lIDQ3NywgaW4gd3JhcHBlcjxiciAvPiAgRmls
ZSAiL3ByaXZhdGUvdmFyL2ZvbGRlcnMvMWovNXpjeGp6a3gyOWI4dGZncmgyeTkwd3Q4MDAwMGduL1Qv
cGlwLWJ1aWxkLXY2WHZJSC9mbGFzay9mbGFzay92aWV3cy5weSIsIGxpbmUgODQsIGluIHZpZXc8YnIg
Lz4gIEZpbGUgIi9wcml2YXRlL3Zhci9mb2xkZXJzLzFqLzV6Y3hqemt4MjliOHRmZ3JoMnk5MHd0ODAw
MDBnbi9UL3BpcC1idWlsZC1qdkVZV0kvZmxhc2stcmVzdGZ1bC9mbGFza19yZXN0ZnVsL19faW5pdF9f
LnB5IiwgbGluZSA1ODcsIGluIGRpc3BhdGNoX3JlcXVlc3Q8YnIgLz4gIEZpbGUgIi9Vc2Vycy9kYXZl
bWFuL0ludGVybmFsL1NjcmF0Y2gvV2ViRGV2L2F3cy1sYW1iZGEvemFwcGEvY29udHJvbGxlcnMvZXJy
b3JfY29udHJvbGxlci5weSIsIGxpbmUgMTUsIGluIGdldDxiciAvPlRlc3RFcnJvcjogJ1RoaXMgaXMg
YSB0ZXN0IGVycm9yJzxiciAvPjwvcHJlPg==: 
Exception Traceback (most recent call last): 
File "/var/task/handler.py", line 161, in lambda_handler return LambdaHandler.lambda_handler(event, context) 
File "/var/task/handler.py", line 55, in lambda_handler return cls().handler(event, context) 
File "/var/task/handler.py", line 155, in handler raise Exception(exception) 
Exception: PCFET0NUWVBFIGh0bWw+NTAwLiBGcm9tIFphcHBhOiA8cHJlPidUaGlzIGlzIGEgdGVzd
CBlcnJvcic8L3ByZT48YnIgLz48cHJlPlRyYWNlYmFjayAobW9zdCByZWNlbnQgY2FsbCBsYXN0KTo8Y
nIgLz4gIEZpbGUgIi92YXIvdGFzay9oYW5kbGVyLnB5IiwgbGluZSA5NiwgaW4gaGFuZGxlcjxiciAvP
iAgICByZXNwb25zZSA9IFJlc3BvbnNlLmZyb21fYXBwKGFwcCwgZW52aXJvbik8YnIgLz4gIEZpbGUgI
i9wcml2YXRlL3Zhci9mb2xkZXJzLzFqLzV6Y3hqemt4MjliOHRmZ3JoMnk5MHd0ODAwMDBnbi9UL3Bpc
C1idWlsZC12Nlh2SUgvV2Vya3pldWcvd2Vya3pldWcvd3JhcHBlcnMucHkiLCBsaW5lIDg2NSwgaW4gZ
nJvbV9hcHA8YnIgLz4gIEZpbGUgIi9wcml2YXRlL3Zhci9mb2xkZXJzLzFqLzV6Y3hqemt4MjliOHRmZ
3JoMnk5MHd0ODAwMDBnbi9UL3BpcC1idWlsZC12Nlh2SUgvV2Vya3pldWcvd2Vya3pldWcvdGVzdC5we
SIsIGxpbmUgODcxLCBpbiBydW5fd3NnaV9hcHA8YnIgLz4gIEZpbGUgIi9wcml2YXRlL3Zhci9mb2xkZ
XJzLzFqLzV6Y3hqemt4MjliOHRmZ3JoMnk5MHd0ODAwMDBnbi9UL3BpcC1idWlsZC12Nlh2SUgvemFwc
GEvemFwcGEvbWlkZGxld2FyZS5weSIsIGxpbmUgNzgsIGluIF9fY2FsbF9fPGJyIC8+ICBGaWxlICIvc
<trimmed>

1 个答案:

答案 0 :(得分:0)

当用户执行未经授权的请求时,AWS会返回Client.UnauthorizedOperation响应,其中包含请求操作的编码详细信息和失败原因。只有允许的用户才能使用命令行或API解密内容。但解码需要该IAM用户的其他权利。

对于CLI: 使用&#39; decode-authorization-message --encoded-message <value>&#39; 。有关更多信息,请参阅http://docs.aws.amazon.com/cli/latest/reference/sts/decode-authorization-message.html

对于API: http://docs.aws.amazon.com/STS/latest/APIReference/API_DecodeAuthorizationMessage.html