2

I am new to AWS. I have just developed a lambda function(Python) which print messages while executing. However I am not sure where I can watch the log printed out while the function is executing.

I found CloudWatch log in the function, but it seems that log is only available after function completed.

Hope you can help,

many thanks

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Luke Mao
  • 87
  • 6
  • Does this answer your question? [how to view aws log real time (like tail -f)](https://stackoverflow.com/questions/34018931/how-to-view-aws-log-real-time-like-tail-f) – luk2302 Jun 17 '21 at 08:32

1 Answers1

3

You are correct -- the print() messages will be available in CloudWatch Logs.

It is possible that a long-running function might show logs before it has completed (I haven't tried that), but AWS Lambda functions only run for a maximum of 15 minutes and most complete in under one second. It is not expected that you would need to view logs while a function is running.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • 1
    FYI, logs do update while the Lambda is running. I don't know if Lambda buffers based on size or time, but in my experience it updates after 10 seconds or a dozen lor so lines of output (far less than the 1 MB/10k records batch size limit). – kdgregory Jun 17 '21 at 11:38