Skip to content

Commit

Permalink
adapt cloudwatch log format regex to parse both logs for node8 and no…
Browse files Browse the repository at this point in the history
…de10 lambda/cloudwatch logs
  • Loading branch information
rickfoxcroft committed Jan 23, 2020
1 parent e6e9525 commit 9288be1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cloudwatchlogs-with-dlq/cloudwatchlogs_lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Regex used to detect logs coming from lambda functions.
// The regex will parse out the requestID and strip the timestamp
// Example: 2016-11-10T23:11:54.523Z 108af3bb-a79b-11e6-8bd7-91c363cc05d9 some message
var consoleFormatRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z\s(\w+?-\w+?-\w+?-\w+?-\w+)\s/;
var consoleFormatRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z\s(\w+?-\w+?-\w+?-\w+?-\w+)\s(INFO|ERROR|WARN|DEBUG)?/;

// Used to extract RequestID
var requestIdRegex = /(?:RequestId:|Z)\s+([\w\d\-]+)/;
Expand Down
2 changes: 1 addition & 1 deletion cloudwatchlogs/cloudwatchlogs_lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var logStreamPrefixRegex = process.env.LOG_STREAM_PREFIX
// Regex used to detect logs coming from lambda functions.
// The regex will parse out the requestID and strip the timestamp
// Example: 2016-11-10T23:11:54.523Z 108af3bb-a79b-11e6-8bd7-91c363cc05d9 some message
var consoleFormatRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z\s(\w+?-\w+?-\w+?-\w+?-\w+)\s/;
var consoleFormatRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z\s(\w+?-\w+?-\w+?-\w+?-\w+)\s(INFO|ERROR|WARN|DEBUG)?/;

// Used to extract RequestID
var requestIdRegex = /(?:RequestId:|Z)\s+([\w\d\-]+)/;
Expand Down

0 comments on commit 9288be1

Please sign in to comment.