manheim / manheim-c7n-tools

Manheim's Cloud Custodian (c7n) wrapper package, policy generator, runner, and supporting tools.
https://manheim-c7n-tools.readthedocs.io/
Apache License 2.0
45 stars 25 forks source link

Logs not being written to output_s3_bucket_name #57

Closed matticulous closed 3 years ago

matticulous commented 3 years ago

We are currently using runner to deploy our policies to our AWS accounts. In our config, we are setting the s3 bucket name to the name of the bucket (following the example config). However, no log output ever gets written to the bucket. Our policies are all configured as mode: periodic (lambda). In the lambda logs, I can see that log output is being written to file:///tmp/[policy_name]. Is there something that I need to be configuring differently? It looks like execution-options are being set for metrics and log-group, but nothing for output_dir.

jantman commented 3 years ago

Matt, yeah, you need to set output_dir in execution-options to a S3 URL. See the example default.yml in this repo - in general, either your policy or your defaults.yml (wherever you specify execution-options) will generally need to look something like:

  execution-options:
    log_group: '%%LOG_GROUP%%'
    output_dir: 's3://%%BUCKET_NAME%%/logs'

manheim-c7n-tools / runner will interpolate that with the log group and bucket names, but log_group and output_dir still need to be explicitly specified.

I'm going to close this issue now in the hope that the above solves your problem, but please feel free to reopen it if you need some more assistance.