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
match log lines when multiple spaces are between individual log fields. #7294
Conversation
'\S+ \S+ \S+ \S+ "\S+ (?P<path>.*?) \S+" (?P<status>\S+) \S+ (?P<length>\S+) ' | ||
'\S+ \S+ \S+ "(?P<referrer>.*?)" "(?P<user_agent>.*?)"' | ||
'\S+\s+(?P<host>\S+)\s+\[(?P<date>.*?)\s+(?P<timezone>.*?)\]\s+(?P<ip>\S+)\s+' | ||
'\S+\s+\S+\s+\S+\s+\S+\s+"\S+\s+(?P<path>.*?)\s+\S+"\s+(?P<status>\S+)\s+\S+\s+(?P<length>\S+)\s+' |
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.
would it work to use \s*
to match any number of spaces?
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.
No, then 308803 might get matched as the status instead of 308 if the log line has 308 803
. Fields have to be separated by spaces.
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.
would \s+
match 1 or more spaces?
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.
Yes, that's what the +
is for.
…ual log fields. Includes python tests.
…e spaces are parsed.
b56cc20
to
97bb8ab
Compare
Looks good to me 👍 |
match log lines when multiple spaces are between individual log fields.
fixes #7228
As title. Includes python tests.
@mattab Review please.