Logging aws_logging_handlers to AWS services that support S3 and Kinesis stream logging with multiple threads
Project description
A python multithreaded logging handler package that streams records to AWS services objects with support for the following AWS services: * S3 * Kinesis
Supports gzip compression(in S3)
Getting Started
Prerequisites
Asynchronous multipart uploading relies on the ability to use multiple threads #### Packages:
boto3
Installing
Installation using pip
pip install aws-logging-handlers
Examples
Stream log records to S3 and Kinesis
import logging from aws_logging_handlers import S3Handler, KinesisHandler bucket="test_bucket" # The bucket should already exist # The log will be rotated to a new object either when an object reaches 5 MB or when 120 seconds pass from the last rotation/initial logging s3_handler = S3Handler("test_log", bucket, workers=3) kinesis_handler = KinesisHandler('log_test', 'us-east-1', workers=1) formatter = logging.Formatter('[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s') s3_handler.setFormatter(formatter) kinesis_handler.setFormatter(formatter) logger = logging.getLogger('root') logger.setLevel(logging.INFO) logger.addHandler(s3_handler) logger.addHandler(kinesis_handler) for i in range(0, 100000): logger.info("test info message") logger.warning("test warning message") logger.error("test error message")
To be developed
Support for asyncio
Logging and upload metrics
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for aws-logging-handlers-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe30f4cbc9016e1fba779fdbdb901596c182ee7de7e560e9eeba5011933356b4 |
|
MD5 | c77f32e0c8c281673b6b1436bc9e64f6 |
|
BLAKE2b-256 | 78e42200c60663226ff91367e8847a525ad973c1baf4774045228d0781cbdcb4 |
Close
Hashes for aws_logging_handlers-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e0c382daa9c37bb578cd8904b1db251ba96bdcd9776c3566904107ff426a310 |
|
MD5 | b97e87ca1c2ab1d7131ccbc5fc30b05e |
|
BLAKE2b-256 | bccc66c039d9810b6d28a16b762e4347ecf60355773a3d285fbde756ba879d6c |