AWS Assignment 10
AWS Assignment 10
Key Features:
Monitoring and Logging: Collects and tracks metrics, collects and monitors log
files, and sets alarms.
Automated Actions: Automatically react to changes in your AWS environment.
Unified Dashboard: Provides a single pane of glass for all your metrics and logs.
Custom Metrics: You can create custom metrics for applications to monitor any
application-specific metric.
Alarms: Set alarms based on thresholds and take corrective actions.
Steps to View AWS Lambda Logs in CloudWatch
Prerequisites:
An AWS account
An existing Lambda function
Steps:
Access the AWS Management Console:
From the list of Lambda functions, select the function for which you want to view
logs.
Go to the Monitoring Tab:
Once inside your Lambda function's configuration page, click on the Monitoring tab.
This tab provides a quick overview of metrics such as invocation count, duration,
and error rate.
View Logs in CloudWatch Logs:
In the Monitoring tab, there is a section for Logs. Click on the link that says
View logs in CloudWatch.
CloudWatch Console:
You will be redirected to the CloudWatch console. Here you can see the log groups
associated with your Lambda function. The log group names usually follow the format
/aws/lambda/<function-name>.
Select a Log Group:
Click on the relevant log group for your Lambda function to view the log streams.
Choose a Log Stream:
Within the log group, you'll see one or more log streams. Log streams are created
by Lambda and named based on the date and time of the logs.
Select the log stream you are interested in to view the detailed logs.
Analyze the Logs:
Once you open a log stream, you can see the detailed logs, including request and
response payloads, error messages, and other log output generated by your Lambda
function.
Set Up Log Retention (Optional):
By default, CloudWatch Logs retains logs indefinitely. You can set up a retention
policy by selecting the log group, clicking on the Actions button, and choosing
Edit retention.