Loading...

What is Appliku?

Icon
Simplest way to deploy Python/Django apps

Push code to Git repo, Appliku will build & deploy the app to your cloud servers.

Learn more .

Start Deploying
Icon
Django project template

Django project template that allows you to start building your app, skipping days of fine tuning project settings..

Get Djangitos
Icon
Appliku SaaS Discord Community

The place where you can talk to like minded individuals who are at different stages of building their SaaS or other apps.

Join Community

Django CloudWatch Logs

Share post:

You can setup sending logs to cloudwatch and have easier access to them instead looking through files or built-in Appliku log viewer.

Currently it only works for servers deployed on AWS.

All EC2 Instances are created by Appliku with CloudWatch Logs Agent, so the only thing you need to setup is the Role for server in AWS Dashboard and change in Application setting.

In order to switch to sending logs to CloudWatch you should:

Create IAM Role

Go to AWS Dashboard, IAM console, select "Roles" and click "Create role", or click this link: https://console.aws.amazon.com/iam/home#/roles$new?step=type

Select EC2 from the common use cases and click "Next: Permissions":

IAM Console Create Role

On the Permissions page search for "CloudWatchAgentServerPolicy" and check the checkbox for this policy and click Next:

CloudWatchAgentServerPolicy

On the "Add Tags" page click "Next: Review".

AWS IAM Role

Attach IAM Role to EC2 Instance

To attach the role, go to EC2 dashboard and select your instance.

Click "Actions" -> "Security" -> "Modify IAM role".

EC2 Dashboard Actions Security Modify IAM role

Pick the IAM Role and click save

Modify IAM role for ec2 instance

Create CloudWatch Log Group

Go to CloudWatch Console , find Logs -> Log Groups.

CloudWatch Console Logs Log Groups

Click "Create log group" Cloudwatch create log group

Give your log group a name and click the "Create" button:

Create cloudwatch log group screen

Configure application to send logs to CloudWatch

Go to Appliku dashboard and open your application settings.

Find the block "AWS CloudWatch log settings" and click "Expand Settings"

Appliku dashboard AWS CloudWatch log settings

Type your log group name from the previous step and select the region where you created the log group, enable Sending logs to AWS CloudWatch and click the "Save Log Settings" button.

AWS CloudWatch logs settings in Appliku

Redeploy the application

Click "Deploy Now" and wait for the process to finish. After that you can see logs from all your containers in CloudWatch Log Groups Streams. Streams will be named after containers automatically.

Share post:
Image Description Top