Cloudwatch not working for lambda function

0

Cloudwatch isn't consistently working for lambda function. Sometimes it works for a user and then it stops working. What can be the reason for it? Thank you

2 Answers
0

It would be helpful to dig deeper into the logs of the function, to check if any error or failure messages. You could also look at the CloudWatch Logs dashboard to see if there are any error messages, or if the logs are being delivered but not showing up in the dashboard. Generally speaking, consider the following points:

  • Ensure that the CloudWatch Log Group associated with your function is not deleted or modified.
  • CloudWatch has some quotas and limits on the number of log events you can send per second and the number of bytes. If your Lambda function is generating more logs than the allowed limit, CloudWatch will not be able to keep up and may stop working for that particular time.
  • Make sure your Lambda function is running in the same region as CloudWatch Logs and that there are no network connectivity issues between them.
  • Make sure you have correctly specified the log group and stream name for your Lambda function.
Amgad
answered a year ago
  • I have a similar issue as the OP in which I was able to see the lambda function print logs to Cloudwatch before, but now it longer does so when accessed by other services like Lex( I am using V2).

    It does, however, work when I use a test case to test the lambda function. In this case, it prints logs successfully.

    In my particular setup, I use Lex to call the lambda function for validation. It does so successfully, because the lambda function returns a value which Lex displays as a text to the user. However, no logs show up in Cloudwatch LogGroups regarding this access. If lambda can write to the LogGroup using the test case, then it makes sense that it should be able to write to the LogGroup when accessed by other AWS services like Lex for example, right?

  • I noticed that after my Lex bot completes fulfillment of an intent, it prints the lambda function accesses to the LogGroup.

    Lex doesn't print to the CloudWatch LogGroup after every access and seems to wait until finishing a chat session with a user to print all the validation lambda accesses in that session to the LogGroup at once. Just my thinking. . .

0

When you say cloudwatch isn't working, could you elaborate - is it that cloudwatch metrics aren't being generated or entries aren't being generated in CloudWatch LogGroups?

How are you running the code - locally, via console or CLI? When you says it works for a user and then stops working, do you mean that for a user it works some of the time then fails or that it works for one user, but not another?

profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions