17
votes

I configure Custom Access Logging for Amazon API Gateway and I need to specify CloudWatch Group name, but when I put these just name of log group in format like "API-Gateway-Execution-Logs_3j5w5m7kv9/stage-name" I get such error:

Invalid ARN specified in the request. ARNs must start with 'arn:': API-Gateway-Execution-Logs_3j5w5m7kv9/stage-name

When I open page of this log group in CloudWatch I just see the same name there and don't see ARN value. How can I find it?

5

5 Answers

38
votes

Go to Cloudwatch logs, find your log group, open it and you'll see a list of log streams. There is settings icon on top right: enter image description here

Click it and you'll see an option to show stream arn:

enter image description here

Save the settings and you'll see stream arns. The part before semicolon looks like Log Group arn

5
votes

The CloudWatch Group ARN format is arn:aws:logs:{region}:{account-id}:log-group:API-Gateway-Execution-Logs_{rest-api-id}/{stage-name}, cf. https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html

2
votes
arn:aws:logs:region:account-id:log-group:log_group_name

See this documentation

1
votes

You can also use AWS CLI

aws logs describe-log-groups | grep <log_group_name> | awk '/arn/'

0
votes

Or you could do a aws logs describe-log-groups | grep <name_of_group>

That works too.