Reputation: 366
So I'm trying to find the source of a strange bug which causes unusual invocation spikes for a particular lambda function. So far, I've added logging functionality to the lambdas and redeployed to glean more info about the context and event objects that trigger the lambda.
So I want to know where these events are originating, and from those aforementioned logged event objects I've found the TopicArn that is the culprit, but how do I go about finding the guilty publisher in this relationship? Any ideas or something I'm overlooking?
Upvotes: 0
Views: 2431
Reputation: 200562
Do you have CloudTrail enabled? You should be able to use CloudTrail to log all the calls to your SNS topics.
Upvotes: 5
Reputation: 17455
Depending on how you logged you might want to attach an SQS queue to the topic too. This would give you the full packet. I can see in one of mine that there is something like:
{
"version": "0",
"id": "7f47b81a-10cc-4b28-be35-123456789",
"detail-type": "Scheduled Event",
"source": "aws.events",
"account": "123456789",
"time": "2017-02-03T18:28:52Z",
"region": "us-east-1",
"resources": [
"arn:aws:events:us-east-1:123456789:rule\/5_min_scheduler"
],
"detail": {
}
}
This is, obviously, from a cloudwatch scheduled event but it does have a source. I don't know for sure that yours will but it's easy to have a topic push to a queue in addition to the Lambda to assist in debugging.
Upvotes: 2