How to enable access logs in haproxy.

2,444 views
Skip to first unread message

Danushka Fernando

unread,
Aug 12, 2016, 10:01:34 AM8/12/16
to Kubernetes developer/contributor discussion
We tried several things but couldn't get it working. We are using haproxy as a pod.

Prashanth B

unread,
Aug 12, 2016, 1:27:12 PM8/12/16
to Danushka Fernando, Kubernetes developer/contributor discussion
Are you talking about the service-loadbalancer specifically, or haproxy in general? For the latter this isn't the right mailing list. 

You can start a syslog server like: https://cbonte.github.io/haproxy-dconv/1.6/snapshot/configuration.html#3.1-log. The service-loadbalancer found at: https://github.com/kubernetes/contrib/tree/master/service-loadbalancer enables through through the `--syslog` option. You can set it by adding: 
```
args:
- --tcp-services=mysql:3306,nginxsvc:443
- --syslog=true
``` 

On Fri, Aug 12, 2016 at 7:01 AM, Danushka Fernando <wdfd...@gmail.com> wrote:
We tried several things but couldn't get it working. We are using haproxy as a pod.

--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/cbb1ab5f-126b-4ee9-b3e9-e478eff64504%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Danushka Fernando

unread,
Aug 12, 2016, 7:33:55 PM8/12/16
to Prashanth B, Kubernetes developer/contributor discussion

It's for the service load balancer we are looking for.

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729


On Aug 12, 2016 10:57 PM, "Prashanth B" <be...@google.com> wrote:
Are you talking about the service-loadbalancer specifically, or haproxy in general? For the latter this isn't the right mailing list. 

You can start a syslog server like: https://cbonte.github.io/haproxy-dconv/1.6/snapshot/configuration.html#3.1-log. The service-loadbalancer found at: https://github.com/kubernetes/contrib/tree/master/service-loadbalancer enables through through the `--syslog` option. You can set it by adding: 
```
args:
- --tcp-services=mysql:3306,nginxsvc:443
- --syslog=true
``` 
On Fri, Aug 12, 2016 at 7:01 AM, Danushka Fernando <wdfd...@gmail.com> wrote:
We tried several things but couldn't get it working. We are using haproxy as a pod.

--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.

Danushka Fernando

unread,
Aug 16, 2016, 5:39:39 AM8/16/16
to Prashanth B, Kubernetes developer/contributor discussion
Hi Prashanth 
Thanks. I wanted the access logs and I couldn't get it with that change. So I added following to the front end sections of template in case someone need it.

{{ if eq .startSyslog "true" }} 
    capture request  header    X-Forwarded-For      len 500
   capture request  header    Host                 len 500
   capture request  header    X-Request-UID        len 500
   rspadd  X-Haproxy-Backend:\ server

   # Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests
   log-format %ci:%cp\ [id=%ID]\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r
   unique-id-format %{+X}o\ %ci:%cp_%fi:%fp_%Ts_%rt:%pid
   unique-id-header X-Haproxy-Unique-ID

   log 192.168.18.2:514 local0 info
{{ end }}
--
Best Regards
Danushka Fernando.
Senior Software Engineer,
WSO2.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages