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
Close
Hashes for kinesis-logger-streamhandler-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 399f8a0fd2008284e6f4734e742e67ef4dc8d33bf5f064954aa0dbd42725551a |
|
MD5 | dc1e0f858093b4147f2b22f1a83a3bc5 |
|
BLAKE2b-256 | 0543c893de0c3d74d691895ab2094e5c8d8b86c45d08d782c1ce9719b3415b14 |
Close
Hashes for kinesis_logger_streamhandler-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7a84952b32a9bea6be4f03e2b17265b8bf9b81b198132ba7b74a6a08bd07f02 |
|
MD5 | 3ecd07400c1630bf0a95a8c94d536d3a |
|
BLAKE2b-256 | f0cbbb72f54c5a6cc2bb73f9ded1d2194529aff39d28c5c4a02f89796f2b3f1b |