<p>How to get access-logs from openshift router (HAproxy).</p>

<p>I tried to use this command:</p>

<pre><code>$ oc project default 
$ oc logs router-1-g...
</code></pre>

<p>I got output:</p>

<pre><code>I0129 09:47:17.125616       1 router.go:554] Router reloaded:
 - Checking http://localhost:80 ...
 - Health check ok : 0 retry attempt(s).
I0129 09:47:54.356142       1 router.go:554] Router reloaded:
 - Checking http://localhost:80 ...
 - Health check ok : 0 retry attempt(s).
</code></pre>

<p>But there was no information about users traffic (client/server requests/responses).</p>

<p>Please give me advice on how I can debug how this proxy is working?</p>

<p>On Openshift &gt;=4.5 you can do it this way by edititing your ingresscontroller and add the following .spec.logging (see below, log format example included):</p>
<pre><code>apiVersion: operator.openshift.io/v1
kind: IngressController
metadata:
  name: default
  namespace: openshift-ingress-operator
spec:
  logging:
    access:
      destination:
        type: Container
      # % formats see here: http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#8.2.3
      httpLogFormat: log_source=&quot;haproxy-default&quot; log_type=&quot;http&quot; c_ip=&quot;%ci&quot; c_port=&quot;%cp&quot;
        req_date=&quot;%tr&quot; fe_name_transport=&quot;%ft&quot; be_name=&quot;%b&quot; server_name=&quot;%s&quot; res_time=&quot;%TR&quot;
        tot_wait_q=&quot;%Tw&quot; Tc=&quot;%Tc&quot; Tr=&quot;%Tr&quot; Ta=&quot;%Ta&quot; status_code=&quot;%ST&quot; bytes_read=&quot;%B&quot;
        bytes_uploaded=&quot;%U&quot; captrd_req_cookie=&quot;%CC&quot; captrd_res_cookie=&quot;%CS&quot; term_state=&quot;%tsc&quot;
        actconn=&quot;%ac&quot; feconn=&quot;%fc&quot; beconn=&quot;%bc&quot; srv_conn=&quot;%sc&quot; retries=&quot;%rc&quot; srv_queue=&quot;%sq&quot;
        backend_queue=&quot;%bq&quot; captrd_req_headers=&quot;%hr&quot; captrd_res_headers=&quot;%hs&quot; http_request=&quot;%r&quot;
</code></pre>
<p>This solution is based on <a href="https://access.redhat.com/solutions/3250781" rel="noreferrer">https://access.redhat.com/solutions/3250781</a>.<br />
There is a solution for Openshift 3.x as well.</p>
<p>You may access the logs by doing 'oc logs -n openshift-ingress &lt;your-router-pod-name&gt; -c logs'.</p>
<p>It is also possible to send those logs directly to a syslog server:</p>
<pre><code>apiVersion: operator.openshift.io/v1
kind: IngressController
metadata:
  name: default
  namespace: openshift-ingress-operator
spec:
  logging:
    access:
      destination:
        type: Syslog
        syslog:
          address: 1.2.3.4
          port: 10514
      # % formats see here: http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#8.2.3
      httpLogFormat: log_source=&quot;haproxy-default&quot; log_type=&quot;http&quot; c_ip=&quot;%ci&quot; c_port=&quot;%cp&quot;
        req_date=&quot;%tr&quot; fe_name_transport=&quot;%ft&quot; be_name=&quot;%b&quot; server_name=&quot;%s&quot; res_time=&quot;%TR&quot;
        tot_wait_q=&quot;%Tw&quot; Tc=&quot;%Tc&quot; Tr=&quot;%Tr&quot; Ta=&quot;%Ta&quot; status_code=&quot;%ST&quot; bytes_read=&quot;%B&quot;
        bytes_uploaded=&quot;%U&quot; captrd_req_cookie=&quot;%CC&quot; captrd_res_cookie=&quot;%CS&quot; term_state=&quot;%tsc&quot;
        actconn=&quot;%ac&quot; feconn=&quot;%fc&quot; beconn=&quot;%bc&quot; srv_conn=&quot;%sc&quot; retries=&quot;%rc&quot; srv_queue=&quot;%sq&quot;
        backend_queue=&quot;%bq&quot; captrd_req_headers=&quot;%hr&quot; captrd_res_headers=&quot;%hs&quot; http_request=&quot;%r&quot;
</code></pre>
