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

Integrating With Systemd #169

Closed
redixhumayun opened this issue Feb 12, 2022 · 3 comments
Closed

Integrating With Systemd #169

redixhumayun opened this issue Feb 12, 2022 · 3 comments

Comments

@redixhumayun
Copy link

I'm using this library for logging in a Python3 multi-processing project. I have used systemd to daemonize the service and start-up automatically on boot and on quitting the program.

Now, my issue is that the library works beautifully when I run the program directly from the command line. However, when I run the program through systemd, for some reason my logs get swallowed and don't show up on AWS.

I have confirmed that my logs are correctly showing up in journald but for some reason they don't get recorded in AWS.

Is there a specific way to handle logging when running with systemd?

@kislyuk
Copy link
Owner

kislyuk commented Feb 13, 2022

Thanks for your interest in Watchtower. This library is completely agnostic with respect to systemd. The problem you are facing most likely has to do with a misconfigured environment, for example a lack of AWS credentials in the process environment. To begin diagnosing the problem, you need to get the full stderr stream from your process and see the errors emitted there.

I'm going to close this issue for now since it doesn't appear to be a bug in Watchtower. If you see something specific that you think should be improved, please feel free to comment or file another issue.

@kislyuk kislyuk closed this as completed Feb 13, 2022
@kislyuk
Copy link
Owner

kislyuk commented Feb 13, 2022

P.S. One common issue when running AWS commands in systemd units is the lack of region configuration. boto3/botocore requires you to set a region before it starts talking to anything. One way to do that is to put this in your override file:

[Service]
Environment="AWS_DEFAULT_REGION=us-east-1"

@redixhumayun
Copy link
Author

@kislyuk This is exactly right. I came back here to comment saying that it was an AWS region issue.

For any one facing this issue, running aws configure and sudo aws configure allow you to configure two different sets of credentials. When running a systemd unit file, it's run as root. So, you need to configure the aws region by running sudo aws configure

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

2 participants