Comments (14)
If anyone wonder how to use debug
option, mentioned above, just use EXTRA_GLOBAL_SETTINGS
with debug
as value, eg:
docker run -d --expose 80 --name webapp dockercloud/hello-world
docker run -d -e EXTRA_GLOBAL_SETTINGS="debug" --link webapp:webapp -p 80:80 dockercloud/haproxy
from dockercloud-haproxy.
I used debug, which worked perfectly. Thanks!
from dockercloud-haproxy.
Suppose I wanted to see the haproxy logs on the terminal
from dockercloud-haproxy.
+1 ?
from dockercloud-haproxy.
By default, the haproxy logs are sent to rsyslog in the container(127.0.0.1). You can use RSYSLOG_DESTINATION` to specify where the log to send to.
from dockercloud-haproxy.
@tifayuki Thanks! How can I log every HTTP request for my backend? What do I have to set in EXTRA_SETTINGS
(in the linked container's env)? I'd like to see every HTTP request with the incoming HTTP headers and then the headers that are sent to the backend (for debugging, because, for someone unknown arcane reason, my service doesn't work when it's proxied through HAProxy...).
from dockercloud-haproxy.
I didn't try, but here is an example of sending the logs to a 3rd party service: https://github.com/tutumcloud/haproxy/issues/60
from dockercloud-haproxy.
@mwaaas just check my previous comment, this is exactly what you asking for.
from dockercloud-haproxy.
@aPoCoMiLogin am trying but its nowt working, to rephrase my issue again is how to show haproxy logs in std
from dockercloud-haproxy.
@mwaaas did you try copy paste my example ?
from dockercloud-haproxy.
@aPoCoMiLogin yes, it does't show the haproxy logs.
By haproxy logs I mean this
Jun 18 08:47:13 localhost haproxy[3500]: xxxxxxx [18/Jun/2016:08:47:13.784] default_default_default_http_8000 default_default_app_servers/xxxxxxxxxxx 0/0/0/18/+18 200 +209 - - ---- 1/1/1/0/0 0/0 "POST /xxxx/xx/xxxx/xxxx HTTP/1.1"
from dockercloud-haproxy.
@mwaaas nope you didn't copy-paste it. Just tested it again and this is the result:
mc:~ filip$ docker run -d --expose 80 --name webapp dockercloud/hello-world
Unable to find image 'dockercloud/hello-world:latest' locally
latest: Pulling from dockercloud/hello-world
420890c9e918: Pull complete
bf670dcc8bf7: Pull complete
cea64ab096a2: Pull complete
f3e501a8bc49: Pull complete
Digest: sha256:fe79a2cfbd17eefc344fb8419420808df95a1e22d93b7f621a7399fd1e9dca1d
Status: Downloaded newer image for dockercloud/hello-world:latest
f2c6be36a4627c654ae9ed8a8324713f48e824b39d3dd27628364e42f066974a
mc:~ filip$ docker run -d -e EXTRA_GLOBAL_SETTINGS="debug" --link webapp:webapp -p 80:80 dockercloud/haproxy
Unable to find image 'dockercloud/haproxy:latest' locally
latest: Pulling from dockercloud/haproxy
6589332ef57c: Pull complete
12731d6f4caf: Pull complete
f1cf9373e1c3: Pull complete
Digest: sha256:604e31baac1150d540c0dc4e7f5360f674389dfd2ffdcdc197f0e8eb90cd5d01
Status: Downloaded newer image for dockercloud/haproxy:latest
2a613deeb042b92ac233f327650a661feea712223b794171be27564e6097615a
mc:~ filip$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2a613deeb042 dockercloud/haproxy "/sbin/tini -- docker" 4 seconds ago Up 3 seconds 443/tcp, 0.0.0.0:80->80/tcp, 1936/tcp jovial_mcclintock
f2c6be36a462 dockercloud/hello-world "/bin/sh -c 'php-fpm " 40 seconds ago Up 40 seconds 80/tcp webapp
mc:~ filip$ docker logs -f jovial_mcclintock
INFO:haproxy:dockercloud/haproxy 1.5.1 is running outside Docker Cloud
INFO:haproxy:Legacy link mode, loading HAProxy definition from environment variables: unable to connect to docker daemon ('Connection aborted.', error(2, 'No such file or directory'))
INFO:haproxy:dockercloud/haproxy PID: 7
INFO:haproxy:==========BEGIN==========
INFO:haproxy:HAProxy configuration:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
log-send-hostname
maxconn 4096
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
daemon
stats socket /var/run/haproxy.stats level admin
ssl-default-bind-options no-sslv3
ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA:DES-CBC3-SHA
debug
defaults
balance roundrobin
log global
mode http
option redispatch
option httplog
option dontlognull
option forwardfor
timeout connect 5000
timeout client 50000
timeout server 50000
listen stats
bind :1936
mode http
stats enable
timeout connect 10s
timeout client 1m
timeout server 1m
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth stats:stats
frontend default_port_80
bind :80
reqadd X-Forwarded-Proto:\ http
maxconn 4096
default_backend default_service
backend default_service
server WEBAPP 172.17.0.2:80 check inter 2000 rise 2 fall 3
INFO:haproxy:Launching HAProxy
INFO:haproxy:HAProxy has been launched(PID: 13)
INFO:haproxy:===========END===========
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result FAILED
Total: 3 (2 usable), will use epoll.
Using epoll() as the polling mechanism.
00000000:default_port_80.accept(0007)=0008 from [172.17.0.1:39452]
00000001:default_port_80.accept(0007)=0009 from [172.17.0.1:39454]
00000000:default_port_80.clireq[0008:ffffffff]: GET / HTTP/1.1
00000000:default_port_80.clihdr[0008:ffffffff]: Host: localhost
00000000:default_port_80.clihdr[0008:ffffffff]: Connection: keep-alive
00000000:default_port_80.clihdr[0008:ffffffff]: Upgrade-Insecure-Requests: 1
00000000:default_port_80.clihdr[0008:ffffffff]: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
00000000:default_port_80.clihdr[0008:ffffffff]: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
00000000:default_port_80.clihdr[0008:ffffffff]: Accept-Encoding: gzip, deflate, sdch
00000000:default_port_80.clihdr[0008:ffffffff]: Accept-Language: en-US,en;q=0.8,pl;q=0.6
00000000:default_service.srvrep[0008:000a]: HTTP/1.1 200 OK
00000000:default_service.srvhdr[0008:000a]: Server: nginx/1.8.1
00000000:default_service.srvhdr[0008:000a]: Date: Mon, 20 Jun 2016 07:02:21 GMT
00000000:default_service.srvhdr[0008:000a]: Content-Type: text/html; charset=UTF-8
00000000:default_service.srvhdr[0008:000a]: Transfer-Encoding: chunked
00000000:default_service.srvhdr[0008:000a]: Connection: keep-alive
00000000:default_service.srvhdr[0008:000a]: X-Powered-By: PHP/5.6.20
00000002:default_port_80.clireq[0008:000a]: GET /logo.png HTTP/1.1
00000002:default_port_80.clihdr[0008:000a]: Host: localhost
00000002:default_port_80.clihdr[0008:000a]: Connection: keep-alive
00000002:default_port_80.clihdr[0008:000a]: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
00000002:default_port_80.clihdr[0008:000a]: Accept: image/webp,image/*,*/*;q=0.8
00000002:default_port_80.clihdr[0008:000a]: Referer: http://localhost/
00000002:default_port_80.clihdr[0008:000a]: Accept-Encoding: gzip, deflate, sdch
00000002:default_port_80.clihdr[0008:000a]: Accept-Language: en-US,en;q=0.8,pl;q=0.6
00000002:default_service.srvrep[0008:000a]: HTTP/1.1 200 OK
00000002:default_service.srvhdr[0008:000a]: Server: nginx/1.8.1
00000002:default_service.srvhdr[0008:000a]: Date: Mon, 20 Jun 2016 07:02:21 GMT
00000002:default_service.srvhdr[0008:000a]: Content-Type: image/png
00000002:default_service.srvhdr[0008:000a]: Content-Length: 13133
00000002:default_service.srvhdr[0008:000a]: Last-Modified: Mon, 11 Apr 2016 09:44:59 GMT
00000002:default_service.srvhdr[0008:000a]: Connection: keep-alive
00000002:default_service.srvhdr[0008:000a]: ETag: "570b721b-334d"
00000002:default_service.srvhdr[0008:000a]: Accept-Ranges: bytes
00000003:default_port_80.clireq[0008:000a]: GET /favicon.ico HTTP/1.1
00000003:default_port_80.clihdr[0008:000a]: Host: localhost
00000003:default_port_80.clihdr[0008:000a]: Connection: keep-alive
00000003:default_port_80.clihdr[0008:000a]: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
00000003:default_port_80.clihdr[0008:000a]: Accept: */*
00000003:default_port_80.clihdr[0008:000a]: Referer: http://localhost/
00000003:default_port_80.clihdr[0008:000a]: Accept-Encoding: gzip, deflate, sdch
00000003:default_port_80.clihdr[0008:000a]: Accept-Language: en-US,en;q=0.8,pl;q=0.6
00000003:default_service.srvrep[0008:000a]: HTTP/1.1 200 OK
00000003:default_service.srvhdr[0008:000a]: Server: nginx/1.8.1
00000003:default_service.srvhdr[0008:000a]: Date: Mon, 20 Jun 2016 07:02:21 GMT
00000003:default_service.srvhdr[0008:000a]: Content-Type: text/html; charset=UTF-8
00000003:default_service.srvhdr[0008:000a]: Transfer-Encoding: chunked
00000003:default_service.srvhdr[0008:000a]: Connection: keep-alive
00000003:default_service.srvhdr[0008:000a]: X-Powered-By: PHP/5.6.20
from dockercloud-haproxy.
I use --log-driver=syslog
on docker 1.7.1 , syslog-ng
cmd:
docker run -d \
--restart always \
--link pt1:pt1 \
-p 33000:80 \
--name ptlb \
--log-driver=syslog \
--log-opt syslog-address=udp://localhost:514 \
dockercloud/haproxy
but only get the first log:
Aug 24 15:54:00 server1 docker/016377edd1ae[5136]: Web server running on port 25555
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:dockercloud/haproxy 1.5.3 is running outside Docker Cloud
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:Legacy link mode, loading HAProxy definition from environment variables: unable to connect to docker daemon ('Connection aborted.', error(2, 'No such file or directory'))
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:dockercloud/haproxy PID: 5
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:==========BEGIN==========
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:HAProxy configuration:
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: global
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: log 127.0.0.1 local0
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: log 127.0.0.1 local1 notice
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: log-send-hostname
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: maxconn 4096
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: pidfile /var/run/haproxy.pid
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: user haproxy
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: group haproxy
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: daemon
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: stats socket /var/run/haproxy.stats level admin
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: ssl-default-bind-options no-sslv3
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA:DES-CBC3-SHA
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: defaults
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: balance roundrobin
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: log global
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: mode http
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: option redispatch
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: option httplog
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: option dontlognull
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: option forwardfor
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: timeout connect 5000
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: timeout client 50000
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: timeout server 50000
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: listen stats
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: bind :1936
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: mode http
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: stats enable
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: timeout connect 10s
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: timeout client 1m
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: timeout server 1m
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: stats hide-version
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: stats realm Haproxy\ Statistics
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: stats uri /
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: stats auth stats:stats
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: frontend default_port_80
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: bind :80
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: reqadd X-Forwarded-Proto:\ http
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: maxconn 4096
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: default_backend default_service
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: backend default_service
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: server PT1 192.168.42.18:25555 check inter 2000 rise 2 fall 3
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:Launching HAProxy
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:HAProxy has been launched(PID: 11)
Aug 24 15:56:10 server1 docker/250fc9609308[5136]: INFO:haproxy:===========END===========
Then no more message.
from dockercloud-haproxy.
@eromoe without debug
flag this is all what you'll see. You have to add debug
to the EXTRA_GLOBAL_SETTINGS
ENV. Like that:
docker run -d \
-e EXTRA_GLOBAL_SETTINGS="debug" \
--restart always \
--link pt1:pt1 \
-p 33000:80 \
--name ptlb \
--log-driver=syslog \
--log-opt syslog-address=udp://localhost:514 \
dockercloud/haproxy
from dockercloud-haproxy.
Related Issues (20)
- Unnecessary redirect from https to https scheme in SSL termination mode HOT 2
- TCP load balancing doesn't work in Docker Swarm Mode
- Basic auth on a single service? HOT 2
- DNS resolution of loggers at startup
- Still experimental in Swarm Mode? HOT 8
- You should be able to indicate explicit Service/Port combos.
- Source balancing does not work on Docker for Mac
- Some question about multi-ports balance and ADDITIONAL_SERVICES
- Is this project dead? HOT 16
- How can i achieve the desired result with NGINX? Anybody else knows?
- Not working properly when using compose mode + service with fixed container names HOT 1
- Swarm service deploy mode = global is not supported
- Put stats on Virtual Host on a port 80 / 443
- Service Unavailable (503) Custom HTML
- Support option for this application
- We have a requirment of altering url for backend service at haproxy, how can we achieve
- tcp的1m超时怎么解决
- Questions about the mysterious project deprecation HOT 1
- imcompatible with docker compose 1.23 HOT 5
- Can not link service or container in compose mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockercloud-haproxy.