I have a lambda_handler function like:
def lambda_handler(event, context):
print('test')
I can see the log output is passing to CloudWatch just fine. I can see the Start, End, Syntax errors, etc. so I don't think it's a permissions thing, but I cannot see my print statements anywhere. I have the following allowed in my IAM role:
Allow: logs:CreateLogGroup
Allow: logs:CreateLogStream
Allow: logs:PutLogEvents
View Logs In The Console. The simplest way to see logs from your AWS lambda function is in the console. Navigate to the monitoring tab of your lambda function and click the “view logs in CloudWatch” button. You should now be inside CloudWatch viewing your log output.
Using the Lambda consoleOpen the Functions page of the Lambda console. Choose a function. Choose Monitor. Choose View logs in CloudWatch.
To troubleshoot a Log group does not exist error from CloudWatch, confirm the following: Your Lambda function's execution role has sufficient permissions to write logs to CloudWatch. The log group resource in the IAM policy includes the name of your function.
There are two ways through which you can output logs from your function code: Use the print method – print(event) Use any logging library that writes to stdout or stderr – logging, aws-lambda-logging.
You can use the Lambda console to view log output after you invoke a Lambda function. For more information, see Accessing Amazon CloudWatch logs for AWS Lambda.
Your Lambda function comes with a CloudWatch Logs log group and a log stream for each instance of your function. The Lambda runtime environment sends details about each invocation to the log stream, and relays logs and other output from your function's code.
I was facing the same problem. For me the missing step was to hit the "deploy" button.
As silly as it sounds, it might save some time to a future reader.
Hey i just faced exactly the same problem. I added several print statements to some very long dicts and afterwards i was not able to display additional print statements (The old print statements were still displayed). I deleted some of the print statements with higher data volume and now it just works fine. SO i guess it is a kind of storage problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With