log-search: Match against path without query parameters.

The nginx logs have query parameters; display them, but do not use
them for URL matching.
This commit is contained in:
Alex Vandiver 2024-01-22 16:42:49 +00:00 committed by Tim Abbott
parent 371dea3f0d
commit 5786a38cec
1 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,7 @@ NGINX_LOG_LINE_RE = re.compile(
" "
(?P<method> \S+ ) (?P<method> \S+ )
\s+ \s+
(?P<path> [^"]+ ) (?P<full_path> (?P<path> [^"?]+ ) (\?[^"]*)? )
\s+ \s+
(?P<http_version> HTTP/[^"]+ ) (?P<http_version> HTTP/[^"]+ )
" \s+ " \s+
@ -159,7 +159,7 @@ PYTHON_LOG_LINE_RE = re.compile(
(?P<code> \d+ ) \s+ (?P<code> \d+ ) \s+
(?P<duration> \S+ ) \s+ # This can be "217ms" or "1.7s" (?P<duration> \S+ ) \s+ # This can be "217ms" or "1.7s"
( \( [^)]+ \) \s+ )* ( \( [^)]+ \) \s+ )*
(?P<path> /\S* ) \s+ (?P<full_path> (?P<path> /\S* ) ) \s+
.* # Multiple extra things can go here .* # Multiple extra things can go here
\( \(
(?P<user> (?P<user>
@ -419,9 +419,9 @@ def print_line(
color = FAIL color = FAIL
if use_color: if use_color:
url = f"{BOLD}{match['path']}" url = f"{BOLD}{match['full_path']}"
else: else:
url = match["path"] url = match["full_path"]
color = "" color = ""
if FilterType.HOSTNAME not in filter_types: if FilterType.HOSTNAME not in filter_types: