c7n.reports package

Submodules

c7n.reports.csvout module

Reporting Tools

Provides reporting tools against cloud-custodian’s json output records.

For each policy execution custodian stores structured output in json format of the records a policy has filtered to in an s3 bucket.

These represent the records matching the policy filters that the policy will apply actions to.

The reporting mechanism here simply fetches those records over a given time interval and constructs a resource type specific report on them.

CLI Usage

$ custodian report -s s3://cloud-custodian-xyz/policies \
  -p ec2-tag-compliance-terminate -v > terminated.csv
class c7n.reports.csvout.Formatter(resource_type, extra_fields=(), include_default_fields=True, include_region=False, include_policy=False, fields=())[source]

Bases: object

extract_csv(record)[source]
headers()[source]
to_csv(records, reverse=True, unique=True)[source]
uniq_by_id(records)[source]

Only the first record for each id

c7n.reports.csvout.fs_record_set(output_path, policy_name)[source]
c7n.reports.csvout.get_records(bucket, key, session_factory)[source]
c7n.reports.csvout.record_set(session_factory, bucket, key_prefix, start_date, specify_hour=False)[source]

Retrieve all s3 records for the given policy output url

From the given start date.

c7n.reports.csvout.report(policies, start_date, options, output_fh, raw_output_fh=None)[source]

Format a policy’s extant records into a report.

Module contents