HAproxyカスタムロゴ


1.コメント構成


コメントまたはdefaultフィールドのoption tcplog(httplog)フィールドを削除します.ここでコメントを選択します.後でテストしても問題ありません.削除に同意します.
defaults
    mode                    tcp
    log                     global
    log 127.0.0.1           local3
    #option                  tcplog
    option                  dontlognull

この構成が存在する場合、エラーが発生します.
[WARNING] 350/150056 (72960) : parsing [/xx/xx/haproxy/etc/haproxy.cfg:25]: 'log-format' overrides previous 'option tcplog' in 'defaults' section.

2.log-format構成の追加


現在ここに貼られているのはテスト用で、後で実際の状況に応じて調整します.
defaults
    ……
    log-format %ci\ -\ %T\ %ST\ %U\ %si\ %cp\ %Th\ %Tw\ %Tc\ %Tt
    ……

3.サービスを再起動して構成を有効にする


ここにlog-formatが使用可能な変数の説明を貼り付けて、私は原文に対して少し調整して、ソースアドレスは:https://blog.csdn.net/chengfei112233/article/details/78983041
変数#ヘンスウ#
フィールド名
説明
を選択します.
コメント
%B
bytes_read
サーバからクライアントへ
数値
%CC
captured_request_クッキー(モードhttpのみ)
文字列
%CS
captured_response_クッキー(モードhttpのみ)
文字列
%H
hostname
文字列
%HM
HTTP method(モードhttpのみ)
例えば、POST
文字列
%HP
HTTP request URI without query string(同上)
例えば:path
文字列
%HQ
HTTP request URI query string(同上)
例えば:?bar=baz
文字列
%HU
HTTP request URI(同上)
例えば:/foo?bar=baz
文字列
http
%HV
HTTPバージョン(同上)
例えば:HTTP/1.0
文字列
%ID
unique-id
文字列
%ST
status_code
数値
%T
gmt_date_time
date
%Ta
Active time of the request
TRからendまで
数値
http
%Tc
Tc
数値
tcp
%Td
Td = Tt - (Tq + Tw + Tc + Tr)
数値
%Tl
local_date_time
date
%Th
connection handshake time
SSL, PROXY proto
数値
tcp
%Ti
idle time before the HTTP request(同上)
数値
%Tq
Th+Ti+TR(同上)
数値
%TR
time to receive the full request from 1 st byte(同上)
数値
%Tr
Tr(同上)
レスポンス時間
数値
http
%Ts
timestamp
数値
%Tt
Tt
数値
tcp
%Tw
Tw
数値
tcp
%U
bytes_uploaded
クライアントからサーバへ
数値
%ac
actconn
数値
%b
backend_name
文字列
%bc
beconn
バックエンド同時接続
数値
%bi
backend_source_ip
せつぞくアドレス
IP
%bp
backend_source_port
接続先のポート
数値
%bq
backend_queue
数値
%ci
client_ip
じゅしんアドレス
IP
%cp
client_port
受信ポート
数値
%f
frontend_name
文字列
%fc
feconn
フロントエンド同時接続
数値
%fi
frontend_ip
フロントエンドパスアドレス
IP
%fp
frontend_port
フロントエンド通過ポート
数値
%ft
frontend_name_transport
「〜」接尾辞はSSL
文字列
%lc
frontend_log_counter
数値
%hr
captured_request_headers default style
文字列
%hrl
captured_request_headers CLF style
文字列リスト
%hs
captured_response_headers default style
文字列
%hsl
captured_response_headers CLF style
文字列リスト
%ms
accept date milliseconds
0で塗りつぶす
数値
%pid
PID
数値
%r
http_request(同上)
文字列
%rc
retries
数値
%rt
request_counter
HTTP reqまたはTCPセッション
数値
%s
server_name
文字列
%sc
srv_conn
サーバの同時接続
数値
%si
server_IP
ターゲットアドレス
IP
%sp
server_port
ターゲットアドレスポート
数値
%sq
srv_queue
数値
%sslc
ssl_ciphers(SSLのみ)
例えばAES-SHA
文字列
%sslv
ssl_バージョン(SSLのみ)
例えば、TLSv 1
文字列
%t
date_time
ミリ秒解像度
date
%tr
date_time of HTTP request(HTTPモードのみ)
date
http
%trg
gmt_date_time of start of HTTP request(同上)
date
http
%trl
locla_date_time of start of HTTP request(同上)
date
http
%ts
termination_state
文字列
%tsc
termination_state with cookie status(同上)
文字列