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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c476cdd52b5f5d6b29cfbcd3d46fc85619ed8b4d70ed5c09d13b6e2138742f |
|
MD5 | 9b7cb53f2adeb90fcba0b7234e4facf8 |
|
BLAKE2b-256 | 24907d4c4df1cbc5b99aac433a3f3b492ca655243d84dd9e143d2206ec5058b7 |
Close
Hashes for kinesis_logger_streamhandler-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb09a3d097910e967c46e024348acb0c3845b35e14ce7900ab9ac24a65246d38 |
|
MD5 | 3903d9331fa4920d380d132846548f14 |
|
BLAKE2b-256 | 2891e4ab0c4f669c1b2fabee4a5c351317263ac208fc99b52269ea4afa364dae |