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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30bf14f58a93047d8824f5797e331978a03a15547e432bc235e698727a0fdae9 |
|
MD5 | 1b4411884df0628f041bdb0afc669315 |
|
BLAKE2b-256 | 4943094c852b97530d476922d73ddd305cb82ec35a4408b0ec71ee6c42153583 |
Close
Hashes for kinesis_logger_streamhandler-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 980a3e2f43899c436de1aed0be8c66a5de3abd16afb88baf7f343cc8da126b9b |
|
MD5 | 81ec3b8610f83acaddf46cd4c07972da |
|
BLAKE2b-256 | 208d6123ec8d52044a4899e61e0d329e7a22d33d4aa770a8491ed386afb5b9e4 |