NodeJS AWS Lambda script for pushing gzipped Cloud Front log files stored in Amazon S3 to Loggly as JSON objects.
- Clone the repository and install dependencies:
npm install
- Configure Loggly by editing cloudfront2loggly.js and changing:
logglyConfig = {
tag: "TAG_NAME",
token: "ACCESS_TOKEN"
};
- Compress the code and upload to AWS Lambda:
zip -r cloudfront2loggly cloudfront2loggly.js node_modules
For more details about AWS Lambda and Loggly, please read:
To alter log data, before pushing to Loggly, change the data object at these lines:
// To alter data (i.e. remove sensitive log content), alter the data object before issuing request.post.
function(data) {
[...]
}