2016-07-28 16 views
-1

aws cliで--queryオプションを使用して出力をフィルタリングしようとしています。しかし、期待どおりに動作しません。AWSクエリ属性が期待通りに機能しない

たとえば、次のコマンドを

aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=ccp-sample --region us-west-2 --query 'Events[0].CloudTrailEvent' 

を使用して、私はこの出力

"{\"eventVersion\":\"1.03\",\"userIdentity\":{\"type\":\"IAMUser\",\"principalId\":\"AIDAIIR6LX4HJMES3LKSO\",\"arn\":\"arn:aws:iam::198282748449:user/yash\",\"accountId\":\"198282748449\",\"accessKeyId\":\"ASIAIT27FOX6LO5AUMCA\",\"userName\":\"yash\",\"sessionContext\":{\"attributes\":{\"mfaAuthenticated\":\"true\",\"creationDate\":\"2016-07-26T12:24:46Z\"}},\"invokedBy\":\"signin.amazonaws.com\"},\"eventTime\":\"2016-07-26T12:55:37Z\",\"eventSource\":\"s3.amazonaws.com\",\"eventName\":\"DeleteBucket\",\"awsRegion\":\"us-west-2\",\"sourceIPAddress\":\"AWS Internal\",\"userAgent\":\"signin.amazonaws.com\",\"requestParameters\":{\"bucketName\":\"ccp-sample\"},\"responseElements\":null,\"requestID\":\"85D3C0AD43A4FB15\",\"eventID\":\"a525764b-0a9e-435d-ae1e-252879da9812\",\"eventType\":\"AwsApiCall\",\"recipientAccountId\":\"198282748449\"}" 

を取得するが、私はこの

aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=ccp-sample --region us-west-2 --query 'Events[0].CloudTrailEvent.eventTime' 

ようなものでイベント時刻を取得しようとしたとき、私はnullになる私はどこが間違っているのか分かりません。

ありがとうございます。

答えて

1

あなたが話しているイベントの時間がわかりません。

aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=ccp-sample --region us-west-2 --query 'Events[0].EventTime' 

CloudTrailEventフィールドをクエリパラメータで調べることはできません。それはJSONの唯一のStringですが、CLIはそのことについて知らない。

関連する問題