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:
parent
cf29ee6dd2
commit
5155ec35c5
5 changed files with 74 additions and 1 deletions
|
@ -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 =
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue