我们主要检查是否可以使用AWS Cloud9执行命令。
如果您想提供示例命令,请使用下面的表格提交。
如果列出的命令示例有任何错误,请在此处更正。
创建日志组
aws logs create-log-group \
--log-group-name ExampleLogGroup
输出
None
by anonymous
创建日志流
aws logs create-log-stream \
--log-group-name ExampleLogGroup \
--log-stream-name ExampleLogStream
输出
None
by anonymous
输出日志事件
TIME="`date +%s`000"
TEXT="This is example message."
EVENT="timestamp=${TIME},message=\"${TEXT}\""
aws logs put-log-events \
--log-group-name ExampleLogGroup \
--log-stream-name ExampleLogStream \
--log-events "${EVENT}"
输出
{
"nextSequenceToken": "49647012347438648207383750719339122106922125597460136466"
}
by anonymous
检查日志事件
aws logs get-log-events \
--log-group-name ExampleLogGroup \
--log-stream-name ExampleLogStream
输出
{
"events": [
{
"timestamp": 1717663812000,
"message": "This is example message.",
"ingestionTime": 1717663813481
}
],
"nextForwardToken": "f/49647012347438648207383750719339122106922125597460136466/s",
"nextBackwardToken": "b/49647012347438648207383750719339122106922125597460136466/s"
}
by anonymous
为具有匹配前缀的日志组批量设置保留期限
logs=$(aws logs describe-log-groups \
--log-group-name-prefix /aws/lambda \
--query 'logGroups[*].[logGroupName]' \
--output text)
for i in $logs; do aws logs put-retention-policy --log-group-nam $i --retention-in-days 7 ;done
输出
None
by anonymous
建议