Searching ALOHA 10.5
Customizing the Log Format
Customizing the Log Format
Log format variables
A log format variable is a string prefixed by the character %
:
%variable
If a variable is between square brackets ([
.. ]
), then it is used as a sample fetch expression rule: (More about data fetches)
%[req.hdr(Host)]
Variables can take arguments using braces ({
.. }
). You can pass multiple arguments separated by commas and within the braces. You can prefix each argument with a flag in order to add or remove it with a +
or -
character:
%{+Q}[req.hdr(Host)]
You can use a special variable %o
to propagate its flags to all following variables in the same format string:
Warning
Avoid spaces; a space character is considered as a separator.
Note
To emit a verbatim %
, it must be preceded by another %
to result in %%
. HAProxy automatically merges consecutive separators.
Available flags are : * Q
: quote a string * X
: hexadecimal representation (IPs, Ports, %Ts, %rt, %pid)
The following table lists available variables:
Variable | Field Name | Type | Limitations |
---|---|---|---|
| Special variable, apply flags to all next variables | ||
| bytes_read (from server to client) | Numeric | |
| captured_request_cookie | String |
|
| captured_response_cookie | String |
|
| hostname | String | |
| HTTP method (ex: POST) | String mode | HTTP only |
| HTTP request URI without query string (path) | String |
|
| HTTP request query string (ex: ?foo=bar ) | String |
|
| HTTP request URI including the query string | String |
|
| HTTP version (ex: HTTP/1.0) | String |
|
| unique-id | String | |
| frontend_log_counter | Numeric | |
| status_code | Numeric | |
| gmt_date_time | Date | |
| Tc | Numeric | |
| local_date_time | Date | |
| Tq | Numeric |
|
| Tr | Numeric |
|
| timestamp | Numeric | |
| Tt | Numeric | |
| Tw | Numeric | |
| bytes_uploaded (from client to server) | Numeric | |
| actconn | Numeric | |
| backend_name | String | |
| beconn (backend concurrent connections) | Numeric | |
| backend_source_ip (connecting address) | IP | |
| backend_source_port (connecting address) | Numeric | |
| backend_queue | Numeric | |
| client_ip (accepted address) | IP | |
| client_port (accepted address) | Numeric | |
| frontend_name | String | |
| feconn (frontend concurrent connections) | Numeric | |
| frontend_ip (accepting address) | IP | |
| frontend_port (accepting address) | Numeric | |
| frontend_name_transport ('~' suffix for SSL) | String | |
| captured_request_headers default style | String | |
| captured_request_headers CLF style | String list | |
| captured_response_headers default style | String | |
| captured_response_headers CLF style | String list | |
| accept date milliseconds | Numeric | |
| PID | Numeric | |
| http_request | String |
|
| retries | Numeric | |
| request_counter (HTTP req or TCP session) | Numeric | |
| server_name | String | |
| srv_conn (server concurrent connections) | Numeric | |
| server_IP (target address) | IP | |
| server_port (target address) | Numeric | |
| srv_queue | Numeric | |
| ssl_ciphers (ex: AES-SHA) | String | SSL only |
| ssl_version (ex: TLSv1) | String | SSL only |
| date_time (with millisecond resolution) | Date | |
| termination_state | String | |
| termination_state with cookie status | String |
|