-
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
Logging #110
Comments
Hi, I'm using a Graylog input to collect HAProxy logs. Note that HAProxy uses UDP. HAProxy process is chrooted before start the event loop, because of that it doesn't have permission to log to stdout and a syslog endpoint is used instead. A JSON log format would be very nice but I didn't play with yet. |
Okay. I did eventually get the logs into fluentd. Perhaps I'll try and
post the configuration here when I get back to it.
…On Sat, Mar 10, 2018, 11:53 AM Joao Morais ***@***.***> wrote:
Hi, I'm using a Graylog input to collect HAProxy logs. Note that HAProxy
uses UDP.
HAProxy process is chrooted before start the event loop, because of that
it doesn't have permission to log to stdout and a syslog endpoint is used
instead.
A JSON log format would be very nice but I didn't play with yet.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#110 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUAmTX9RqiKSc33tWYOMEuojpP9TP1Rks5tdC8lgaJpZM4SjmPI>
.
|
we strapped an rsyslog sidecar to the ingress pod, and have that logging to stdout. |
Here's the fluentd config I used:
Then you have to expose that UDP port, like:
And create a service:
And point haproxy at it in the config map:
Not sure if this should be dumped into the docs somewhere. |
I'll leave this open in order to remember to update the examples doc. Thanks for sharing. |
@dobesv thanks for posting fluentd example. worth opening a separate doc chapter for that. |
@jcmoraisjr Can you please document how you used Graylog to collect HAProxy logs |
Hi, it's pretty straighforward: create a syslog udp input, choose a port, start the input and use ip(graylog host):port(from input) on syslog-endpoint. |
Access-logs Logging can also be achieved using a netcat sidecar container. Make the sidecar container to listen on 514 port and then configure syslog-endpoint as localhost:514. Here are my configurations:
Configmap
|
@shubhasish Thanks for your tip! I have a sidecar defined like this:
And i have my haproxy-ingress configmap like this:
With this configuration, i get output like this:
I'd love to see a working configuration I could use-- that'd be really helpful! |
update: i can see the logs, but I'm finding that they appear only for a short while-- then they stop working. |
@dcowden this never happened with me. And we can change the log-format using key |
This ended up having to do with using g the netcat container. When I changed to using an rsyalig container the problem disappeared. |
I use for this http://smarden.org/socklog/ in my Dockerfile https://gitlab.com/aleks001/haproxy18-centos/blob/master/Dockerfile#L31-36 and configure haproxy to log there.
This makes the |
Hello
And the error is:
How to fix? |
Your error isn't really related to haproxy, it's your fluentd config that is messed up. |
I know it. I ask man that post configs for fluentd |
Here's updated regexp with a little fix:
|
Could someone provide me the simplest way to get meaningful HA Proxy debug logging from this controller without external dependencies like fluentd? I have a simple POC I want to test without having to spin up a full observability stack. |
@LeeHampton Maybe #110 (comment) would be the way to go. |
@jcmoraisjr @dobesv Would this solution output the same info as providing |
I had the same issue. But I have been using netcat for syslog -> stdout before without issues, so I investigated further. First, Here is what I did.
I find this much better than the official sidecar that require root (uid 0) to run. |
@dobesv just added a few lines of doc regarding options to log to stdout, see #1138 . This can be done either placing haproxy as a sidecar, or configuring haproxy to log along with controller on a single container topology. No need for a special syslog sidecar anymore. Can we consider this issue fixed, or maybe do you have any improvement suggestion for the doc? |
Yes I think that addresses it. Does that mean the controller is receiving the syslog messages and then printing them to stdout? |
When running in master-worker mode, we have a chance to configure the haproxy process to send logs to the same output the controller does, so in the end both controller and haproxy shares stdout and stderr of the controller container. |
This issue got stale and will be closed in 7 days. |
There's some documentation on how to tell this to log to syslog, but that isn't the way logging seems to be done normally on kubernetes. Instead you log to stdout / stderr and it is collected by the logging handler and passed along to your log collector of choice (e.g. fluentd).
I did try to tell this to send logs to fluentd using the syslog protocol without much success, I'm not sure where I messed up the configuration.
I'm not a fan of that approach because it is not as reliable - the kubernetes log collector will buffer logs to a file if fluentd isn't running or falls behind, but fluentd listening for syslog messages will not.
What are you using to collect access logs?
I'd also like to be able to include some headers in the access logs, such as user-agent and some custom app headers, and format it all in JSON for easy parsing by fluentd.
The text was updated successfully, but these errors were encountered: