Interview Prep/AWS/Rapid-Fire AWS CLI

How do you set retention on every log group that has none?

BeginnerProductionRapid-Fire AWS CLI
Answer
for lg in $(aws logs describe-log-groups \
    --query 'logGroups[?retentionInDays==`null`].logGroupName' --output text); do
  aws logs put-retention-policy --log-group-name "$lg" --retention-in-days 30
done
aws All AWS questions

More on Rapid-Fire AWS CLI