-
Notifications
You must be signed in to change notification settings - Fork 137
Add log stream name prefix filtering, especially for AWS Batch logs #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add log stream name prefix filtering, especially for AWS Batch logs #98
Conversation
cloudwatchlogs-with-dlq/Readme.md
Outdated
| * SOURCE_NAME_OVERRIDE (OPTIONAL) - Override _sourceName metadata field within SumoLogic. | ||
| * INCLUDE_LOG_INFO (OPTIONAL) - Set it to true when loggroup/logstream values needs to be included in logs. Default is false | ||
| * LOG_FORMAT - Default is Others. One can choose VPC-JSON for VPC flow logs in json format and VPC-RAW for only RAW message line | ||
| * LOG_STREAM_PREFIX (OPTIONAL) - Comma separated list of logStream name prefixes to filter by logStream, expecially for AWS Batch logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"especially"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cc67fdb
| "includeSecurityGroupInfo": ("INCLUDE_SECURITY_GROUP_INFO" in env) ? env.INCLUDE_SECURITY_GROUP_INFO === "true" : false, | ||
| // Regex to filter by logStream name prefixes | ||
| "logStreamPrefixRegex": ("LOG_STREAM_PREFIX" in env) | ||
| ? new RegExp('^(' + env.LOG_STREAM_PREFIX.replace(/,/g, '|') + ')', 'i') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might want to escape the values from the CSV, unsure the range of characters that you're allowed to use but any regex modifier that might be in one of the items would corrupt the final regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in bd4b656
|
@himanshu219, could you please review this PR? |
himanshu219
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM I think we can add this variable in Cloudformation template as well. what do you think?
|
Good idea 💡 Added the variable in e64128c |
|
Thanks |
Background
All of AWS Batch logs are sent to one log group,
/aws/batch/job, and the log stream name format isjobDefinitionName/default/ecs_task_id:https://docs.aws.amazon.com/batch/latest/userguide/job_states.html
Changes
In order to stream logs of specific AWS Batch jobs to SumoLogic, this PR is adding log stream name prefix filtering for CloudWatch logs