-
Notifications
You must be signed in to change notification settings - Fork 41
Description
In a recent update, we successfully implemented a placeholder parsing feature to extract structured data from logs. This functionality is implemented through the PlaceholderParser class and has been verified with unit tests.
Optimization Suggestions and Discussion
Extensibility of Placeholder Formats
Currently, the placeholder parser only supports the %s format. To meet the needs of more scenarios, we suggest supporting additional placeholder formats
Robustness of Exception Handling
If the log format does not match expectations during parsing, the current implementation returns an empty map (Collections.emptyMap()). To enhance the robustness of the system, we suggest:
Logging failed parsing attempts
Providing more detailed error information for debugging purposes
Question: Should the exception handling mechanism be improved?
Performance Optimization
For large-scale log parsing, the current implementation may not meet the demands of high-concurrency scenarios. We suggest:
Optimizing the parsing algorithm
Supporting batch parsing to improve efficiency
Configuration Flexibility
The parsing script for PlaceholderParser is currently provided through LogParserData. To enhance configuration flexibility, we suggest:
Supporting hot updates for parsing scripts
Supporting loading parsing scripts from external files or databases
Example Issue
Assume the log format is:
User [wtt] logged in from IP [192.168.1.1] at time [2025-04-07 15:36:45]
The current parsing script is:
String parseScript = "User [%s] logged in from IP [%s] at time [%s]";
Questions:
If a placeholder (e.g., at time [...]) is missing from the log, will the parsing result lose other valid fields?
Should partial matching be supported instead of full matching?