Skip to content
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

Merged
merged 2 commits into from Mar 2, 2015

Conversation

diosmosis
Copy link
Member

fixes #7228

As title. Includes python tests.

@mattab Review please.

'\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+'
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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.

@mattab mattab modified the milestone: Piwik 2.11.2 Feb 25, 2015
@diosmosis diosmosis force-pushed the 7228_multiple_spaces_import_logs branch from b56cc20 to 97bb8ab Compare February 25, 2015 22:59
@mattab mattab changed the title Fixes #7228, match log lines when multiple spaces are between individual log fields. match log lines when multiple spaces are between individual log fields. Mar 2, 2015
@mattab
Copy link
Member

mattab commented Mar 2, 2015

Looks good to me 👍

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Mar 2, 2015
mattab pushed a commit that referenced this pull request Mar 2, 2015
match log lines when multiple spaces are between individual log fields.
@mattab mattab merged commit 5893863 into master Mar 2, 2015
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Mar 2, 2015
@diosmosis diosmosis deleted the 7228_multiple_spaces_import_logs branch March 2, 2015 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants