-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to configure option httplog in the configmap #185
Comments
as a side note, it appears that /etc/haproxy/template/haproxy.tpml doesnt appear to have a stanza for option httplog, so i'm assuming there's no current way to get it in there: defaults I'm trying to do performance analysis, so i need option httplog. |
looking at the source for the template, it seems like there's no way to inject options httplog , unless specifying log-format {{ $cfg.HTTPSLogFormat }} will activate it. For now i'll try a workaround of specifying a custom log format that's as the same as httplog would have given |
Ok, I'm stuck i think. My problem is that I need performance/request logging, but I want the data to to stdout ( so that it is in the docker logs ) vs syslog. Unless i'm missing something, its not possible to configure the ingress controller to send request logging to stdout, because all of the options are conditional on syslog Is there a workaround/option? Right now the only thing i know to do is to make a derivative image, and change the template in there, which i'd rather not do! |
For those others trying to get timestamps in the docker logs: The plot thickens-- it appears that haproxy itself wont send data to stderr/stdout-- only syslog. I found this thread that helps There i mention of starting up syslog/rsyslogd so that the data appears in stdout, but this doesnt appear implemented in this container. This discussion is also relevant: I can't believe it is this difficult to get standard access logs into the docker logs! I feel like i'm missing something easy! |
Thanks @Scukerman! I will try the sidecar approach. |
Thanks for the suggestion @Scukerman , I got the sidecar running. I'm seeing some odd behavior, though,i'm hoping someone has seen. When i first start up the ingress ( with sidecar as described in #110), I get logging perfectly. However, after about 1 minute or so, no further access logs show up. Restarting the pod restores logging for about the same period of time, then it stops. There are no errors in access_log or the haproxy log. Anyone have ideas? |
I don't use the sidecar approach because it's much easier to get all the logs in one place. I run a separate pod with P.S. I use Deployment instead of DaemonSet. |
awesome! thanks for the help! i'll try that! |
SOLVED-- for documentation purposes, i've documenting what worked for me. @Scukerman is right that a centralized deployment of a syslog is best. This prevents the need to restart the ingress pods when changing thigns, which is nice. Sadly, I couldn't take advantage of that strategy because my ingress controllers use hostNetwork:true, since we are on cni and k8s < 1.9. a service providing in-cluster syslog isn't resolvable by DNS. I used this sidecar strategy, which works well:
Advice for newcomers, I stumbled on the combination of haproxy's log format and yaml escaping. Here's a working configmap, which does a custom log format escaped correctly:
Finally, and again for newcomers, here's the manifests to deploy a stand-alone syslog server for haproxy, in the case your ingress controllers are using hostPort instead of hostNetwork. We will move to this approach when we can use hostPort
|
My congrats! But be careful, now all of your ports are outside cuz of |
Yep, unfortunately. The ideal situation will be to upgrade so we can do host Port. Thanks again for your help |
I use regular deployments, service hostPort and CNI since k8s 1.7. The only problem is I have to use So what the point in the upgrade? Didn't get it. |
Ah yes. I forget to mention one other constraint we have. Since we operate in the cloud, we have to terminate tls at the ingress controller ( so terminating tls at the upstream elb and then using nodeport doesn't work for us). Now that I think about it, though, I guess we could still put a service in front of the ingress controller... |
We're using lb as a service with proxy protocol and we terminate traffic at the ingress controller or pass through to the service. The only one thing is different - we use bare-metal servers. |
Awesome, thanks for point this idea out. this has given me an idea to try! |
I feel like i must be missing it-- how do i get 'option httplog' into the frontend configuration for the ingress controller?
i found tcp-log-format and https-log-format and http-log-format. However, these seem to be intended to activate custom formats, and further the documentation says they are only used when syslog is in use ( i'm using the default configuration, which is sending data to stdout ).
Our ingress controller has generated this haproxy frontend config:
But we want this:
The text was updated successfully, but these errors were encountered: