Skip to main content

Cloud Custodian - Cloud Watch Log S3 exporter

Project description

c7n-log-exporter: Cloud watch log exporter automation

A small serverless app to archive cloud logs across accounts to an archive bucket. It utilizes cloud log export to s3 feature for historical exports.

It also supports kinesis streams / firehose to move to realtime exports in the same format as the periodic historical exports.

Features

  • Log group filtering by regex
  • Incremental support based on previously synced dates
  • Incremental support based on last log group write time
  • Cross account via sts role assume
  • Lambda and CLI support.
  • Day based log segmentation (output keys look like $prefix/$account_id/$group/$year/$month/$day/$export_task_uuid/$stream/$log)

Assumptions

Cli usage

make install

You can run on a single account / log group via the export subcommand

c7n-log-exporter export --help

Config format

To ease usage when running across multiple accounts, a config file can be specified, as an example.

destination:
  bucket: custodian-log-archive
  prefix: logs2

accounts:
  - name: custodian-demo
    role: "arn:aws:iam::111111111111:role/CloudCustodianRole"
    groups:
      - "/aws/lambda/*"
      - "vpc-flow-logs"

Multiple accounts via cli

To run on the cli across multiple accounts, edit the config.yml to specify multiple accounts and log groups.

c7n-log-exporter run --config config.yml

Serverless Usage

Edit config.yml to specify the accounts, archive bucket, and log groups you want to use.

make install
make deploy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

c7n_logexporter-0.4.11-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file c7n_logexporter-0.4.11-py3-none-any.whl.

File metadata

  • Download URL: c7n_logexporter-0.4.11-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.0

File hashes

Hashes for c7n_logexporter-0.4.11-py3-none-any.whl
Algorithm Hash digest
SHA256 d27de074a5ba292805d4aac8967d8a21c2a872c57044e565e1f0a8b48608a5a3
MD5 ae9baf6e25a3d66c4259f658afda6609
BLAKE2b-256 49195c87153743a57a0351c17b22738f2a360148a65ff03d21e2ef10d34e2c05

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page