turbot/aws_thrifty

Control: Unused log streams should be removed if not required

Description

Unnecessary log streams should be deleted for storage cost savings.

Usage

Run the control in your terminal:

powerpipe control run aws_thrifty.control.cw_log_stream_unused

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_thrifty.control.cw_log_stream_unused --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1cloudwatch_log_stream_age_max_days
90
The maximum number of days log streams are allowed without any log event written to them.

SQL

select
arn as resource,
case
when last_ingestion_time is null then 'error'
when date_part('day', now() - last_ingestion_time) > $1 then 'alarm'
else 'ok'
end as status,
case
when last_ingestion_time is null then name || ' is not reporting a last ingestion time.'
else name || ' last log ingestion was ' || date_part('day', now() - last_ingestion_time) || ' days ago.'
end as reason
, region, account_id
from
aws_cloudwatch_log_stream;

Tags