How to use "AWS logs tail" - syntax question

Viewed 378

I'm new to AWS CLI and having trouble getting the tail command to work. I'm using version 2. I try the syntax

aws logs tail group_name /aws/lambda/schedule-jobs --since 1h

and it gives me the error

unknown options: /aws/lambda/schedule-jobs

If I try it without the group_name it tells me the group_name is a required parameter (of course).
If I try it with another log group name it tells me the same error message (with the different log group name).
If I put quotes around the name it gives the same error message.

I know this must be a very simple scenario but I can't find any working examples on Google search or in other SO entries. What am I doing wrong?

Yes, when I call

aws logs describe-log-groups

my log group is there and spelled correctly. I'm in the right account and region.

Yes, I am an admin on the account and have full access to the logs.

2 Answers

Just write aws logs tail /aws/lambda/schedule-jobs --since 1h

aws logs tail command doesn't work on aws cli v2.

You can use the following command to access the logs using v2 API.

aws logs get-log-events --log-group-name <log-group-name> --log-stream-name <log-stream-name> --limit=1000
Related