Skip to content

Commit

Permalink
Merge pull request #2 from techservicesillinois/develop
Browse files Browse the repository at this point in the history
Update Makefile to allow extracting zip file from container
  • Loading branch information
JonRoma authored Feb 4, 2022
2 parents 15cf85c + f4d8dde commit 2301e9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions splunk-cloudwatch-logs-processor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CONTAINER = dummy

IMAGE = cloudwatch-to-splunk

# The zip file is created by 'npm run build:zip', which is called
# by 'docker build'.
ZIP_FILE = splunk-cloudwatch-logs-processor.zip

all: build

build: Dockerfile
docker build -t $(IMAGE) .
docker create -it --name $(CONTAINER) $(IMAGE) bash
docker cp $(CONTAINER):/usr/src/$(ZIP_FILE) .
docker rm -f $(CONTAINER)

clean:
docker rm -f $(CONTAINER)
rm -f $(ZIP_FILE)
3 changes: 2 additions & 1 deletion splunk-cloudwatch-logs-processor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ exports.handler = (event, context, callback) => {
console.log('Received context:', JSON.stringify(context, null, 2));

// CloudWatch Logs data is base64 encoded so decode here
const payload = new Buffer(event.awslogs.data, 'base64');
const payload = new Buffer.from(event.awslogs.data, 'base64');

// CloudWatch Logs are gzip compressed so expand here
zlib.gunzip(payload, (error, result) => {
if (error) {
Expand Down

0 comments on commit 2301e9b

Please sign in to comment.