Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to decode CloudWatch Logs events
const zlib = require('zlib');
exports.decode = async (data) => {
const compressedPayload = Buffer.from(data, 'base64');
const jsonPayload = zlib.gunzipSync(compressedPayload).toString('utf8');
return JSON.parse(jsonPayload);
}
import zlib
import json
from base64 import b64decode
def decode(data):
compressed_payload = b64decode(data)
json_payload = zlib.decompress(compressed_payload, 16+zlib.MAX_WBITS)
return json.loads(json_payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.