Follow the instructions below to send logs stored on AWS S3 to Logentries.
All source code and dependencies can be found on the le_lambda Github page.
- Forwarding AWS ELB and CloudFront logs
- (make sure to set ELB/CloudFront to write logs every 5 minutes)
- When forwarding these logs, the script will format the log lines according to Logentries KVP spec to make them easier to analyze
- Forwarding OpenDNS logs
-
Log in to your Logentries account
-
Add a new token based log
- Optional: repeat to add second log for debugging
-
Create a new Lambda function
-
Choose the Python blueprint for S3 objects
-
Configure triggers:
- Choose the bucket log files are being stored in
- Set event type "Object Created (All)"
- Tick "Enable Trigger" checkbox
-
Configure function:
- Give your function a name
- Set runtime to Python 2.7
-
Edit code:
- Edit the contents of
le_config.py
- Replace values of
log_token
anddebug_token
with tokens obtained earlier. - Create a .ZIP file, containing the updated
le_config.py
,le_lambda.py
and the foldercertifi
- Make sure the files and
certifi
folder are in the root of the ZIP archive
- Make sure the files and
- Choose "Upload a .ZIP file" in "Code entry type" dropdown and upload the archive created in previous step
- Edit the contents of
-
Lambda function handler and role
- Change the "Handler" value to
le_lambda.lambda_handler
- Choose "Create a new role from template" from dropdown and give it a name below.
- Leave "Policy templates" to pre-populated value
- Change the "Handler" value to
-
Advanced settings:
- Set memory to 1536 MB (script only runs for seconds at a time)
- Set timeout to a high value, just below of log file creation frequency
- Below example is configured for ELB logs written every 5 minutes
- Leave VPC value to "No VPC" as the script only needs S3 access
- If you choose to use VPC, please consult Amazon Documentation
-
Enable function:
- Click "Create function"
- The "Test" button execution in AWS Lambda will ALWAYS fail as the trigger is not provided by the built in test function. In order to verify, upload a sample file to source bucket