Enable debug logs to monitor AWS Lambda function invocation in WSO2 API Manager
In this article, I discuss how to enable AWSLambdaMediator and AWS SDK debug logs to monitor AWS Lambda requests/responses
There are two types of logs that you can enable to monitor logs related AWS Lambda function invocation.
- AWSLambdaMediator logs
- AWS SDK logs
1. Enabling logs for AWSLambdaMediator
AWSLambdaMediator
class handles Lambda function invocation using the AWS SDK. It provides some useful logs such as the payload
, access method
, and status
. Follow these steps to enable logs for AWSLambdaMediator
.
i. Open <APIM_HOME>/repository/conf/log4j2.properties
file.
ii. Add following lines to the bottom.
logger.AWS_LAMBDA_MEDIATOR.name = org.wso2.carbon.apimgt.gateway.mediators.AWSLambdaMediator
logger.AWS_LAMBDA_MEDIATOR.level = DEBUG
iii. Append AWS_LAMBDA_MEDIATOR
to loggers list.
loggers = ..., AWS_LAMBDA_MEDIATOR
iv. Save and close log4j2.properties
file.
2. Enabling logs for com.amazonaws
components.
Although AWSLambdaMediator
provides some useful information, debug logs from com.amazonaws
classes will be needed to detect any misbehaviour. Here are the steps to enable logs for com.amazonaws
components.
i. Open <APIM_HOME>/repository/conf/log4j2.properties
file.
ii. Add following lines to the bottom.
logger.COM_AMAZONAWS.name = com.amazonaws
logger.COM_AMAZONAWS.level = DEBUG
iii. Append COM_AMAZONAWS
to loggers list.
loggers = ..., COM_AMAZONAWS
iv. Save and close log4j2.properties
file.
That’s it! Now try invoking a Lambda function through WSO2 API Gateway and you will be able monitor the logs. Thanks for reading my article.