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 3 years have passed since last update.

CloudWatch ロググループの保持期間を一括で設定(上書き)する

Posted at

過去のゴミが溜まっているので、面倒なので一括で上書き設定するスクリプト

bash
#!/bin/bash

for i in $(aws logs describe-log-groups | jq -r ".logGroups[].logGroupName")
do
  aws logs put-retention-policy --log-group-name $i --retention-in-days 30
  echo "complate $i"
done

この後、数日後に CloudWatchの空になったロググループ削除
辺りのスクリプトを流せば、30日以上ログが出力されていないロググループのお掃除が完了する

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?