Skip to main content
https://img.shields.io/pypi/v/s3logs.svg?style=flat-square https://img.shields.io/pypi/dm/s3logs.svg?style=flat-square

Get files from directory by mask and push them to S3

Install

pip install s3logs

Usage

s3logs config.conf

Where config.conf can use that structure:

[S3]
access_key = <S3_KEY>
secret_key = <S3_SECRET_KEY>
host = <s3.example.com>
bucket = <bucket_name>
chunk_size = <bytes, default=52428800>

[logs]

suffix = .gz
key_suffix = .gz
directory = /var/log/nginx/
depth = 30

[map]

example.com-access.log = example/access
example.com-error.log = example/error
mysite.me.access.log = mysite/access

When it used with that config, script takes all files in directory /var/log/nginx/, filter only those, which ends with .gz and send it to S3, according to map.

For example, /var/log/nginx now consists of:

example.com-access.log
example.com-access.log.0.gz
example.com-access.log.1.gz
example.com-error.log
example.com-error.log.0.gz
example.com-error.log.1.gz
mysite.me.access.log
mysite.me.access.log.0.gz
mysite.me.error.log
mysite.me.error.log.0.gz

So, if today is 9 December 2015, and your hostname is node1, on your S3 <bucket_name> would be those keys:

node1/example/access/2015-12-09.gz
node1/example/access/2015-12-08.gz
node1/example/error/2015-12-09.gz
node1/example/error/2015-12-08.gz
node1/mysite/access/2015-12-09.gz

Because we have not explain how maps mysite.me.error.log.0.gz - it would be skipped.

Script also checks whether file exists in S3 and push only those, which are not.

Parameter depth stops pushing, if filename is older, than .<depth>.gz

Download files

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

Source Distribution

s3logs-1.6.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3logs-1.6.macosx-10.11-x86_64.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file s3logs-1.6.tar.gz.

File metadata

  • Download URL: s3logs-1.6.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for s3logs-1.6.tar.gz
Algorithm Hash digest
SHA256 3bed2ae05885b1f471bc927fb80f2365eb2d4e8ab4dd7758f4fd3d687efe812c
MD5 395d89dd3e10622141e1b3e0a303ad4e
BLAKE2b-256 6c4568be6d0f55beb0368d6f42573867955bcec723dd86fedab98de4ca4140f5

See more details on using hashes here.

File details

Details for the file s3logs-1.6.macosx-10.11-x86_64.tar.gz.

File metadata

File hashes

Hashes for s3logs-1.6.macosx-10.11-x86_64.tar.gz
Algorithm Hash digest
SHA256 2e87c98c397af111bd74b0b2bfd5d3bb48172d39d6961b0f4ce2d157a8cb30e8
MD5 8f90fdee7ad3e1c52edd93fba353a111
BLAKE2b-256 c5f232d4042e9b680f672efeea3e2e979ba213143fef9eb5cd9f81e14b05b808

See more details on using hashes here.

Release history Release notifications | RSS feed

1.8

1 file

1.7

1 file

This release

1.6 This release

2 files

1.5

2 files

1.4

2 files

1.3

1 file

1.2

1 file

1.1

1 file

1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page