|
|
@@ -110,13 +110,25 @@ def parse_log_line(line):
|
|
|
return parse_log_line_pipe_format(line)
|
|
|
parts = line.split()
|
|
|
# Formato clásico de Squid: timestamp elapsed ip code/status bytes method url rfc931 peerstatus/peerhost type
|
|
|
- if len(parts) >= 10 and parts[5] in ("CONNECT", "GET", "POST", "HEAD", "PUT", "DELETE", "OPTIONS", "TRACE", "PATCH"):
|
|
|
+ if len(parts) >= 10 and parts[5] in (
|
|
|
+ "CONNECT",
|
|
|
+ "GET",
|
|
|
+ "POST",
|
|
|
+ "HEAD",
|
|
|
+ "PUT",
|
|
|
+ "DELETE",
|
|
|
+ "OPTIONS",
|
|
|
+ "TRACE",
|
|
|
+ "PATCH",
|
|
|
+ ):
|
|
|
try:
|
|
|
return {
|
|
|
"ip": parts[2],
|
|
|
"username": parts[2] if parts[2] != "-" else None,
|
|
|
"url": parts[6],
|
|
|
- "response": int(parts[3].split("/")[-1]) if "/" in parts[3] and parts[3].split("/")[-1].isdigit() else 0,
|
|
|
+ "response": int(parts[3].split("/")[-1])
|
|
|
+ if "/" in parts[3] and parts[3].split("/")[-1].isdigit()
|
|
|
+ else 0,
|
|
|
"data_transmitted": int(parts[4]) if parts[4].isdigit() else 0,
|
|
|
"method": parts[5],
|
|
|
"status": parts[3],
|