turbot/gcp_compliance

Query: logging_sink_configured_for_all_resource

Usage

powerpipe query gcp_compliance.query.logging_sink_configured_for_all_resource

SQL

with project_sink_count as (
select
project,
count(*) no_of_sink
from
gcp_logging_sink
where
filter = ''
and destination != ''
group by
project
)
select
'https://www.googleapis.com/logging/v2/projects/' || s.project resource,
case
when s.no_of_sink > 0 then 'ok'
else 'alarm'
end as status,
case
when s.no_of_sink > 0
then 'Sinks configured for all log entries.'
else 'Sinks not configured for all log entries.'
end as reason
, p.project_id as project
from
gcp_project p
left join project_sink_count s on s.project = p.project_id;

Controls

The query is being used by the following controls: