Retrieving logs

Use tools like Awslogs instead, since they make it much easier

I did this to get logs for invocations of aws lambda functions

  1. First, get the list of log groups and note down the group you want logs for:

    aws logs describe-log-groups
  2. Log groups contain multiple log streams, which can be displayed by recency with the following command. Note down the log stream you’re interested in (typically the first one in the list):

    aws logs describe-log-streams --order-by LastEventTime --descending --log-group-name 'my-log-group'
  3. View the logs for the chosen log group and stream:

    aws logs get-log-events --log-group-name my-log-group --log-stream-name my-log-stream

Awslogs

Makes it much easier to view logs from cloudwatch.

Can be installed with pipx.

awslogs get /aws/lambda/lambda-log-group ALL --watch