Describe the bug
There appears to be a bug in the AWS Greengrass Log Manager component. The component's default log configuration uses a regular expression to match component names, and it seems this is causing some logs to be misrouted. Specifically, when there are two components whose names are similar — such as com.devopstar.Robocat and com.devopstar.RobocatContainer — the logs for the latter are incorrectly being picked up by the former due to the regular expression matching the beginning of both names.
To Reproduce
- Create two components with similar names, where one name is a prefix of the other. For example,
com.devopstar.Robocat and com.devopstar.RobocatContainer.
- Configure logging for
com.devopstar.Robocat using the default logFileRegex option
- Observe that logs generated for
com.devopstar.RobocatContainer get forwarded to the log configuration for com.devopstar.Robocat
Environment
- OS: Rasbian 32bit
- JDK version: openjdk 11.0.18 2023-01-17
- Nucleus version: 2.10.1
- Log Manager version: 2.3.3
Additional context
This bug could potentially result in incorrect logging, with logs from one application mistakenly sent to another. While not necessarily catastrophic, it could lead to confusion when troubleshooting and auditing logs, as it isn't immediately obvious that logs from different applications are being mixed up. It's recommended that the regular expression be revised to ensure a more accurate matching of component names to their logs.
I am currently able to prevent this behaviour by setting the logFileRegex to something like the following: com\\.devopstar\\.Robocat(_\\d{4}_\\d{1,2}_\\d{1,2}_\\d{1,2}_\\d{1,2})?\\.log
Describe the bug
There appears to be a bug in the AWS Greengrass Log Manager component. The component's default log configuration uses a regular expression to match component names, and it seems this is causing some logs to be misrouted. Specifically, when there are two components whose names are similar — such as
com.devopstar.Robocatandcom.devopstar.RobocatContainer— the logs for the latter are incorrectly being picked up by the former due to the regular expression matching the beginning of both names.To Reproduce
com.devopstar.Robocatandcom.devopstar.RobocatContainer.com.devopstar.Robocatusing the defaultlogFileRegexoptioncom.devopstar.RobocatContainerget forwarded to the log configuration forcom.devopstar.RobocatEnvironment
Additional context
This bug could potentially result in incorrect logging, with logs from one application mistakenly sent to another. While not necessarily catastrophic, it could lead to confusion when troubleshooting and auditing logs, as it isn't immediately obvious that logs from different applications are being mixed up. It's recommended that the regular expression be revised to ensure a more accurate matching of component names to their logs.
I am currently able to prevent this behaviour by setting the
logFileRegexto something like the following:com\\.devopstar\\.Robocat(_\\d{4}_\\d{1,2}_\\d{1,2}_\\d{1,2}_\\d{1,2})?\\.log