From 40dc4c2e3cc5bfc94f4232b6cad48374a1a07c9d Mon Sep 17 00:00:00 2001 From: Forza Date: Tue, 8 Oct 2024 20:50:37 +0200 Subject: [PATCH] Add missing identity position for Common and Combined formats --- logparse | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/logparse b/logparse index 8e19ba4..e5346ee 100755 --- a/logparse +++ b/logparse @@ -3,7 +3,7 @@ # shellcheck shell=bash # Caddy webserver JSON log parser -# version 0.1.0 +# version 0.1.1 # # This script reads a Caddy logfile in JSON format and # outputs it in Apache Common Log Format. @@ -270,32 +270,34 @@ case "$format" in common) # Common Log format log_format \ - client_ip \ - space user_id \ - space lsqb datetime rsqb \ - space quote method \ - space uri space proto quote \ - space status space size + client_ip \ + space hyphen \ + space user_id \ + space lsqb datetime rsqb \ + space quote method \ + space uri space proto quote \ + space status space size ;; combined) # Combined Log format # '_' can be used instead of 'space' # 'q' can be used instead of 'quote' log_format \ - client_ip \ - _ user_id \ - _ lsqb datetime rsqb \ - _ q method _ uri _ proto q \ - _ status \ - _ size \ - _ q referer q \ - _ q user_agent q + client_ip \ + _ hyphen \ + _ user_id \ + _ lsqb datetime rsqb \ + _ q method _ uri _ proto q \ + _ status \ + _ size \ + _ q referer q \ + _ q user_agent q ;; custom) debug "main: calling: log_format $use_selectors" # Only use specified selectors # shellcheck disable=SC2086 - log_format $use_selectors + log_format $use_selectors ;; esac @@ -327,7 +329,7 @@ esac # # Where: # %h is the remote host (client IP) -# %l is the remote logname (not used, so we'll use -) +# %l is the remote identity (not used, so we'll use -) # %u is the authenticated user # %t is the time the request was received # %r is the request line from the client ("method uri proto")