How do I query to fetch all log groups present in my account based on retention period.
My main goal is :
- To get a list of all log groups
- List should filter based on retention period
What was I trying until now:
aws logs describe-log-groups --query 'logGroups[*].{logGroupName: logGroupName, retentionInDays: retentionInDays}' --output json
then checking for ‘retentionInDays’ to give me results for never expire.
Issues with this approach:
If log groups are too many maybe in thousands, this approach takes too much time.
So I would appreciate help if there is direct or maybe faster query to fetch logs groups based on retention period
Thanks!