The integration for Logentries and OpsGenie uses the Logentries REST Query API to enrich alerts from any OpsGenie connected monitoring tool with Logentries data.
These scripts are intended to be run in AWS Lambda and triggered by AWS API Gateway.
- An OpsGenie integration like Nagios, PTRG, New Relic or Datadog sends an alert to OpsGenie.
- A key word or phrase from the alert is identified in OpsGenie and the OpsGenie webhook does a GET request to an Amazon API Gateway.
- This triggers Lambda functions that:
- Enumerate all of the logs in the Logentries' customer account.
- Use the Logentries REST Query API to search all logs in the customer’s account for the provided key word or phrase.
- Returns all Logentries data containing the key word or phrase in the last 20 minutes (configurable).
- OpsGenie attaches the results as a file to the alert.
- The alert from an OpsGenie integration is viewed with the added information of the Logentries log data via the OpsGenie desktop or mobile interface.
- An OpsGenie user can also manually execute the query again from the OpsGenie interface to get the most recent logs.
For assistance in setting up the Logentries and OpsGenie integration please reach out to Logentries or OpsGenie Support:
Clone this repository to your local machine.
- In the file
Logentries-OpsGenie/lambda.py
: - Add the
requests
library to the same directory aslambda.py
*pip install requests -t /path/to/project-dir
- Zip up the lambda.py with
requests
library - Upload to Lambda
- In Lambda, update the handler parameter in Lambda configuration to be
lambda.lambda_handler
- Add the
boto3
library (provided in the repository) to the same directory aslambdaInvoker.py
- Add the name of the lambda function that you created in step 5 above as the value of FunctionName parameter in
lambdaInvoker.py
script on line 11 - Zip up the
lambdaInvoker.py
with boto3 library - Create another lambda function in AWS Lambda Service, and upload this zip to Lambda
- Update the handler parameter in Lambda configuration to be
lambdaInvoker.lambda_handler
- In AWS API Gateway create a new API.
- Create a new GET method with a Lambda Function integration type.
- Specify the Lambda function name for the Lambda function resulting from
lambdaInvoker.py
as detailed above. - Configure the Authorization Settings for the GET method
Please contact OpsGenie support: [email protected]