AWS Kinesis logger streamhandler with AWS Session Management
Project description
Kinesis Logger Stream Handler
This package contains
AwsSessionManagement - handles AWS Session with AWS Temp credentials by Assuming a given Role it renews the temp credentials when needed
AWS Kinesis Logger StreamHandler - a logging streamhandler which can send logs to AWS Kinesis
Usage:
def get_kinesis_client(aws_access_key_id, aws_secret_access_key, aws_session_token):
logger.info("creating/updating kinesis client ...")
kinesis = boto3.client('kinesis', region_name=get_region(),
aws_access_key_id = aws_access_key_id,
aws_secret_access_key = aws_secret_access_key,
aws_session_token = aws_session_token)
logger.info("returning new kinesis client")
return kinesis
logger = logging.getLogger("my-package")
logger.setLevel(logging.INFO)
kinesisAwsSessionManagement = AwsSessionManagement(role_arn='roleArnValue',
external_id='externalIdValue',
func=get_kinesis_client,
role_session_name="KinesisSession")
kinesis_stream_handler = KinesisDataStreamHandler(kinesis_stream_name, 'subsystem_value', 'component_value', 'action_value', 'project_name', 'env', 'version', kinesisAwsSessionManagement)
kinesis_stream_handler.setLevel(logLevel)
logger.addHandler(kinesis_stream_handler)
Now, every logging call will send the logs both to console and kinesis data stream with a given 'kinesis_stream_name'
Project details
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
File details
Details for the file kinesis-logger-streamhandler-0.0.8.tar.gz
.
File metadata
- Download URL: kinesis-logger-streamhandler-0.0.8.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30bf14f58a93047d8824f5797e331978a03a15547e432bc235e698727a0fdae9 |
|
MD5 | 1b4411884df0628f041bdb0afc669315 |
|
BLAKE2b-256 | 4943094c852b97530d476922d73ddd305cb82ec35a4408b0ec71ee6c42153583 |
File details
Details for the file kinesis_logger_streamhandler-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: kinesis_logger_streamhandler-0.0.8-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 980a3e2f43899c436de1aed0be8c66a5de3abd16afb88baf7f343cc8da126b9b |
|
MD5 | 81ec3b8610f83acaddf46cd4c07972da |
|
BLAKE2b-256 | 208d6123ec8d52044a4899e61e0d329e7a22d33d4aa770a8491ed386afb5b9e4 |