GrepBoard/매뉴얼
605 편 ·

HAProxy option httplog not usable 경고 해결

·시험 환경 HAProxy 3.4.7 (Docker haproxy:lts) · Ubuntu 24.04 haproxy 2.8.30 · 2026-10·시험 범위 ↓·5 단계

HAProxy 'option httplog' not usable 경고는 defaults 의 httplog 가 mode tcp 프런트엔드로 상속된 것입니다. 거기에 option tcplog 를 넣습니다.

output
[WARNING]  (1) : parsing [/usr/local/etc/haproxy/a.cfg:7] : 'option httplog' not usable with frontend 'tls_passthrough' (needs 'mode http'). Falling back to 'option tcplog'.

option httplog 은 HTTP 모드에서만 쓰는 옵션인데, mode tcp 인 프런트엔드(여기서는 tls_passthrough)에 적용됐다는 경고입니다. 문구대로 HAProxy 는 그 프런트엔드만 option tcplog 로 바꿔 쓰고 시작은 막지 않습니다(종료 코드 0). 거의 늘 defaults 의 option httplog 가 TCP 프런트엔드로 상속된 것이고, 그 프런트엔드에 option tcplog 한 줄을 넣으면 사라집니다.

[1] 경고의 줄 번호가 가리키는 곳을 봅니다. **프런트엔드가 아니라 option httplog 를 쓴 줄**입니다. 위 경고의 7행은 defaults 안입니다.

run/cfg/a.cfg
defaults    mode http    log global    option httplog…frontend tls_passthrough    mode tcp    bind :8443    default_backend app_tls

경고 속 프런트엔드 이름('tls_passthrough')으로 mode tcp 인 곳을 찾습니다. Ubuntu 24.04 패키지의 기본 /etc/haproxy/haproxy.cfg 도 defaults 에 mode http 와 option httplog 를 넣어 두므로, 여기에 TLS 통과용 TCP 프런트엔드를 더하면 그대로 이 경고가 납니다.

output
20:defaults21:	log	global22:	mode	http23:	option	httplog

[2] 프런트엔드가 하나도 mode 를 안 정했는데 경고가 나면 defaults 에 mode http 가 빠진 것입니다. mode 의 기본값은 TCP 라서, defaults 에 option httplog 만 두면 HTTP 로 쓰려던 프런트엔드(web)도 TCP 가 됩니다.

output
[WARNING]  (1) : parsing [/usr/local/etc/haproxy/b.cfg:6] : 'option httplog' not usable with frontend 'web' (needs 'mode http'). Falling back to 'option tcplog'.

이때는 로그 형식보다 모드가 틀린 것이 문제입니다. HTTP 로 다룰 생각이었다면 defaults 에 mode http 를 넣습니다. 넣은 뒤 경고가 사라졌습니다.

[3] TCP 프런트엔드에 option tcplog 를 넣습니다. 프런트엔드에서 다시 정한 값이 defaults 에서 받은 값을 덮습니다.

run/cfg/a-tcplog.cfg
frontend tls_passthrough    option tcplog    mode tcp    bind :8443    default_backend app_tls

no option httplog 로 끄려 하면 오류로 바뀝니다. 3.4.7 과 2.8.30 모두 같았습니다.

output
[ALERT]    (1) : config : parsing [/usr/local/etc/haproxy/a-no.cfg:17]: negation/default is not supported for option 'httplog'.

[4] HTTP 와 TCP 프런트엔드가 여럿이면 defaults 를 이름을 붙여 둘로 나눕니다. 공식 문서는 각 섹션이 기본으로 "앞에 나온 마지막 defaults" 를 받고, from <이름> 으로 원하는 defaults 를 고를 수 있다고 설명합니다.

run/cfg/a-named.cfg
defaults http_defaults    mode http    log global    option httplog…defaults tcp_defaults    mode tcp    log global    option tcplog…frontend web from http_defaults    bind :8080    default_backend app backend app from http_defaults    server s1 192.0.2.10:80 frontend tls_passthrough from tcp_defaults    bind :8443    default_backend app_tls backend app_tls from tcp_defaults    server s1 192.0.2.10:443

HTTP 섹션 둘과 TCP 섹션 둘에 모두 from 을 붙인 이 설정은 3.4.7 과 Ubuntu 의 2.8.30 에서 경고 없이 통과했습니다.

**기존 HTTP 섹션에도 from http_defaults 를 빠짐없이 붙입니다.** defaults tcp_defaults 를 기존 설정 중간에 넣으면, 그 아래에 있는 from 없는 섹션은 모두 tcp_defaults 를 받아 mode tcp 가 됩니다(공식 문서의 "앞에 나온 마지막 defaults" 규칙). 위 설정에서 frontend web·backend app 의 from 만 빼고 web 에 option forwardfor 를 둔 시험 결과입니다(3.4.7 · 2.8.30 같음).

output
[WARNING]  (10) : config : parsing [/usr/local/etc/haproxy/a-named-trap-fwd.cfg:28] : defaults section 'tcp_defaults' (declared at /usr/local/etc/haproxy/a-named-trap-fwd.cfg:12) is explicitly referenced by another proxy and implicitly used here. To avoid any ambiguity don't mix both usage. Add a last defaults section not explicitly used or always use explicit references.[WARNING]  (10) : 'option forwardfor' ignored for frontend 'web' as it requires HTTP mode.Warnings were found.

option forwardfor 가 무시된 것이 web 이 TCP 로 바뀌었다는 증거입니다. 그런데도 종료 코드는 0 이라 배포는 그대로 지나갑니다. HTTP 전용 줄이 없는 섹션이면 첫 경고(is explicitly referenced by another proxy and implicitly used here)만 남으니, 이 문구가 보이면 from 이 빠진 섹션이 있는 것입니다. 경고의 줄 번호(28)는 from 이 빠진 섹션 다음 섹션의 첫 줄이었습니다. 되돌릴 때는 넣은 defaults tcp_defaults 블록과 from 들을 지우고 [3]의 방법으로 돌아갑니다.

[5] 검사합니다. 판에 따라 성공 출력이 다르므로 종료 코드로 봅니다.

console
$ haproxy -c -f /etc/haproxy/haproxy.cfg; echo "exit=$?"
판경고가 있을 때고친 뒤
3.4.7(공식 이미지)Warnings were found. · 종료 코드 0출력 없음 · 0
2.8.30(Ubuntu 24.04)Warnings were found. + Configuration file is valid · 0Configuration file is valid · 0

경고만으로는 종료 코드가 0 이라 자동 배포에서 지나갑니다. -dW 를 더하면 이 경고도 Some warnings were found and 'zero-warning' is set. Aborting. 과 종료 코드 1 이 됩니다. 쓰는 법과 되돌리는 법은 HAProxy -c Warnings were found에 있습니다. 통과하면 sudo systemctl reload haproxy 로 반영합니다.

TCP 로그 한 줄을 읽는 법은 HAProxy 로그 한 줄 읽기를 봅니다.

HAProxy 로그를 브라우저에서 바로 분석 ↗ — 아무것도 올라가지 않습니다.

#haproxy#httplog#tcplog#mode-tcp