Repository navigation
fix(log-surgeon): Fix schema regex patterns in the heuristic schema file and LogConverter; Add a unit test to build a parser for the heuristic schema file.
#1948
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
Changes from all commits
4b2bf99
00aeabd
b4871eb
b94315f
b1c7d4c
066199b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,13 +26,14 @@ namespace { | |||||
| * minus sign for timezone offsets. | ||||||
| */ | ||||||
| constexpr std::string_view cTimestampSchema{ | ||||||
| R"(timestamp:(\d{2,4}[ /\-]{0,1}[ 0-9]{2}[ /\-][ 0-9]{2})|([ 0-9]{2}[ /\-])" | ||||||
| R"(header:(?<timestamp>((\d{2,4}[ /\-]{0,1}[ 0-9]{2}[ /\-][ 0-9]{2})|([ 0-9]{2}[ /\-])" | ||||||
| R"(((Jan(uary){0,1})|(Feb(ruary){0,1})|(Mar(ch){0,1})|(Apr(il){0,1})|(May)|(Jun(e){0,1})|)" | ||||||
| R"((Jul(y){0,1})|(Aug(ust){0,1})|(Sep(tember){0,1})|(Oct(ober){0,1})|(Nov(ember){0,1})|)" | ||||||
| R"((Dec(ember){0,1}))[ /\-]\d{2,4})[ T:][ 0-9]{2}:[ 0-9]{2}:[ 0-9]{2})" | ||||||
| R"(([,\.:]\d{1,9}){0,1}([ ]{0,1}(UTC){0,1}[\+\-]\d{2}(:{0,1}\d{2}){0,1}Z{0,1}){0,1})" | ||||||
| R"((Dec(ember){0,1}))[ /\-]\d{2,4}))[ T:][ 0-9]{2}:[ 0-9]{2}:[ 0-9]{2})" | ||||||
| R"(([,\.:]\d{1,9}){0,1}([ ]{0,1}(UTC){0,1}[\+\-]\d{2}(:{0,1}\d{2}){0,1}Z{0,1}){0,1}))" | ||||||
|
Comment on lines
28
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Verify timestamp capture boundaries after the regex regrouping. The added 🤖 Prompt for AI Agents |
||||||
| }; | ||||||
| constexpr std::string_view cDelimiters{R"(delimiters: \t\r\n\[\(:)"}; | ||||||
|
|
||||||
| constexpr std::string_view cDelimiters{R"(delimiters: \t\r\n[(:)"}; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's check the current state of the file
cat -n components/core/src/clp_s/log_converter/LogConverter.cpp | sed -n '30,40p'Repository: y-scope/clp Length of output: 695 🏁 Script executed: # Check if schemas.txt exists and what it contains regarding delimiters
find . -name "schemas.txt" -type fRepository: y-scope/clp Length of output: 91 🏁 Script executed: # Look for any reference to cDelimiters in the codebase
rg "cDelimiters" --type cpp --type hpp -A 2 -B 2Repository: y-scope/clp Length of output: 82 🌐 Web query:
💡 Result: In a C++ raw string literal, the only thing you must avoid inside the content is the exact closing sequence: where So how do you include
|
||||||
| constexpr std::string_view cDelimiters{R"(delimiters: \t\r\n[(:)"}; | |
| constexpr std::string_view cDelimiters{R"delim(delimiters: \t\r\n[(:)")delim"}; |
🤖 Prompt for AI Agents
In `@components/core/src/clp_s/log_converter/LogConverter.cpp` at line 35, The raw
string literal for cDelimiters in LogConverter.cpp ends prematurely because the
default raw-string terminator R"(...)" clashes with the intended delimiter
characters ')' and '"' — change cDelimiters to use a custom raw-string delimiter
(e.g., R"DELIM(... )DELIM") so the characters ')' and '"' inside the content are
preserved; update the declaration of constexpr std::string_view cDelimiters to
use that custom delimiter delimiter name to ensure the full delimiter list from
components/core/config/schemas.txt is included unchanged.
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.
If I'm understanding correctly, doesn't this stop this rule from working with most unicode?
Would be fine with this as a temporary workaround as long as we create an issue to track fixing this case.
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're right, although afaik log-surgeon doesn't work properly with unicode in general.
I made y-scope/log-surgeon#207 (I forgot to add it to the PR description sorry). I'm not sure if we also want to add an issue to clp to track the log surgeon issue (lmk if you'd like that).
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.
As long as it's tracked somewhere that's fine with me.