Skip to content

Commit 67d783f

Browse files
committed
zlib
1 parent b095b3f commit 67d783f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cloudwatch-logs.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs'
22
import readline from 'readline'
33
import rabbit from './rabbit.js'
4-
import zlib from 'zlib';
4+
import zlib from 'zlib'
55

66
let counter = 0
77
const lines = []
@@ -23,8 +23,11 @@ async function processLines () {
2323

2424
export function lambda (e) {
2525
const payload = Buffer.from(e.awslogs.data, 'base64')
26-
const data = zlib.gunzipSync(payload).toString('utf8')
27-
console.log(data)
26+
const json = JSON.parse(zlib.gunzipSync(payload).toString('utf8'))
27+
28+
for (const logEvent of json.logEvents) {
29+
console.log('Message:', logEvent.message)
30+
}
2831
setTimeout(rabbit.close, 10000)
2932
}
3033

0 commit comments

Comments
 (0)