Last active
April 14, 2017 10:38
-
-
Save Mikulas/a06ab9090e0ebb106b16affa59540488 to your computer and use it in GitHub Desktop.
AWS Lambda CloudWatch Stream processor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Buffer = require('buffer').Buffer; | |
var zlib = require("zlib"); | |
exports.handler = (event, context, callback) => { | |
var rawGzEnc = event.awslogs.data; | |
var rawGz = Buffer.from(rawGzEnc, 'base64'); | |
var raw = zlib.gunzipSync(rawGz).toString(); | |
var data = JSON.parse(raw); | |
console.log(data); | |
// TODO process data | |
}; |
Author
Mikulas
commented
Apr 14, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment