From 70082c7d7e0c3508888ab527849c937eff1a6621 Mon Sep 17 00:00:00 2001 From: erezrokah Date: Fri, 21 Oct 2022 13:46:44 +0300 Subject: [PATCH] fix!: dont quote CloudWatch filter pattern --- src/utils/cloudwatch.test.ts | 2 +- src/utils/cloudwatch.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/cloudwatch.test.ts b/src/utils/cloudwatch.test.ts index 982229d0..cdd7f7d9 100644 --- a/src/utils/cloudwatch.test.ts +++ b/src/utils/cloudwatch.test.ts @@ -92,7 +92,7 @@ describe('cloudwatch utils', () => { expect(cloudWatchLogs).toHaveBeenCalledWith({ region }); expect(filterLogEvents).toHaveBeenCalledTimes(1); expect(filterLogEvents).toHaveBeenCalledWith({ - filterPattern: `"${filterPattern}"`, + filterPattern, interleaved: true, limit: 1, logGroupName, diff --git a/src/utils/cloudwatch.ts b/src/utils/cloudwatch.ts index ce441173..f9e3e093 100644 --- a/src/utils/cloudwatch.ts +++ b/src/utils/cloudwatch.ts @@ -7,10 +7,9 @@ export const filterLogEvents = async ( region: string, logGroupName: string, startTime: number, - pattern: string, + filterPattern: string, ) => { const cloudWatchLogs = new AWS.CloudWatchLogs({ region }); - const filterPattern = `"${pattern}"`; // enclose with "" to support special characters const { events = [] } = await cloudWatchLogs .filterLogEvents({