Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I specify the aws_region within the logging yaml file? #175

Closed
dibog opened this issue Jun 8, 2022 · 3 comments
Closed

Can I specify the aws_region within the logging yaml file? #175

dibog opened this issue Jun 8, 2022 · 3 comments

Comments

@dibog
Copy link

dibog commented Jun 8, 2022

First off, thanks for this library. I'm playing around and it looks really nice.
But I have a question. It seems that watchtower requires the aws_region. Would it be possible
to specify the region via the logging yaml file from the example: https://github.com/kislyuk/watchtower#examples-python-logging-config

Something like:

watchtower:
    class: watchtower.CloudWatchLogHandler
    region: eu-central-1
    formatter: json
    level: DEBUG
    log_group_name: watchtower
    log_stream_name: "{logger_name}-{strftime:%y-%m-%d}"
    send_interval: 10
    create_log_group: False

I know that you can specify the region via the boto3.client. But I would like to keep my main program free form
such "logging details".

Thanks!

@kislyuk
Copy link
Owner

kislyuk commented Jun 8, 2022

Not directly, but you can use the boto3_profile_name argument, and configure a custom boto3 profile (https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-a-configuration-file) in your boto3 config file with the region specified.

@kislyuk kislyuk closed this as completed Jun 8, 2022
@dibog
Copy link
Author

dibog commented Jun 9, 2022

Why not adding such a region property into the logging profile?
I would like to not add another config file, where there is already an appropriate (e.g. logging.yaml).

@darnes
Copy link

darnes commented Aug 7, 2022

@dibog from my experience adding it to the lib initialization breaks some nice features such as boto auto-config inside ec2 instance.
As a workaround, you can use the AWS_DEFAULT_REGION environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants