mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-21 05:28:00 +02:00
Parse external request id from request headers, and print it in access log (#22906)
Close: #22890. --- ### Configure in .ini file: ```ini [log] REQUEST_ID_HEADERS = X-Request-ID, X-Trace-Id ``` ### Params in Request Header ``` X-Trace-ID: trace-id-1q2w3e4r ```  ### Log output: 
This commit is contained in:
@ -576,6 +576,22 @@ ROUTER = console
|
||||
;; The routing level will default to that of the system but individual router level can be set in
|
||||
;; [log.<mode>.router] LEVEL
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Print request id which parsed from request headers in access log, when access log is enabled.
|
||||
;; * E.g:
|
||||
;; * In request Header: X-Request-ID: test-id-123
|
||||
;; * Configuration in app.ini: REQUEST_ID_HEADERS = X-Request-ID
|
||||
;; * Print in log: 127.0.0.1:58384 - - [14/Feb/2023:16:33:51 +0800] "test-id-123"
|
||||
;;
|
||||
;; If you configure more than one in the .ini file, it will match in the order of configuration,
|
||||
;; and the first match will be finally printed in the log.
|
||||
;; * E.g:
|
||||
;; * In reuqest Header: X-Trace-ID: trace-id-1q2w3e4r
|
||||
;; * Configuration in app.ini: REQUEST_ID_HEADERS = X-Request-ID, X-Trace-ID, X-Req-ID
|
||||
;; * Print in log: 127.0.0.1:58384 - - [14/Feb/2023:16:33:51 +0800] "trace-id-1q2w3e4r"
|
||||
;;
|
||||
;; REQUEST_ID_HEADERS =
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
|
Reference in New Issue
Block a user