Allow multiple directories per log config #473
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding support for wildcard use in all parts of directory configs, it currently is limited to only last part of directory string. In addition, refactoring certain part of the code structure to improve readability. List of main changes:
Change
logConfigMapto usePair<>for keys: This map is essentially only used in Kubernetes mode byRecursiveFSEventProcessor. During the pod directory traversal, we use this map to determine if there are any configs left for directories in a sublevel. Now that we have wildcards in the directory names, we can no longer usesubMap()function reliably. Thus, we change the approach to directly use directory depth for this purpose. The Pair consists of directory depth (for ordering) and directory (for tracking, can contain wildcard).Change approach for Wildcard matching: Before we use to translate the wildcards to regex pattern, now we use Apache Commons
FilenameUtils.wildcardMatch+ Files.walkFileTree for traversal, which should be a bit more efficient than using regex.MissingDirChecker: Removed extra data structure to hold wildcard directories, now we combine them into the existing map and perform dynamic discovery for wildcard directories only.
Tested the following scenarios in devapp: