0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CloudTrailから特定の作業を検索

Posted at

CloudTrailのログから特定の作業を検索

たまに使うので個人用メモとして残しておく

準備

  • aws cliが導入済み
  • jqが導入済み
  • CloudTrailでログを出力

作業

ログの確認

  1. ログを展開
# gunzip *.json.gz 等
gzになっているので閲覧出来るようにする

検索する

2-1. ログから指定のイベントを検索

SecurityGroupからの削除を検索
# cat CLOUDTRAIL_LOG_NAME.json | jq '.Records[]|select(contains({eventName:"RevokeSecurityGroupIngress"}))'
API名で検索すればOK

2-2. ユーザの名前で検索

admin-user01を検索
# cat CLOUDTRAIL_LOG_NAME.json | jq '.Records[]|select(.userIdentity.userName == "admin-user01")'

.userIdentity.sessionContext.sessionIssuer.userName の場合もあるからAPIによる?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?