How to get access-logs from OpenShift router (HAProxy)?

1/30/2018

How to get access-logs from openshift router (HAproxy).

I tried to use this command:

$ oc project default 
$ oc logs router-1-g...

I got output:

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).

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

Please give me advice on how I can debug how this proxy is working?

-- Slavik Muz
kubernetes
openshift
openshift-origin

2 Answers

1/30/2018

You will need to point the router at a syslog server to debug the output. No access logs are output by default. You are seeing the logs of the Go process.

I created a rsyslog container some time ago to help debug issues with a custom router. This will log to stdout for debugging purposes only. Follow the instructions in the readme to deploy this within the default project. Shout if you need any further help.

-- PhilipGough
Source: StackOverflow

11/16/2018

In the openshift 3.11, you could create a new router using oc adm router command with extended logging enabled

  1. New router
oc adm router myrouter --extended-logging
  1. Enable debug logging
oc set env dc/myrouter ROUTER_LOG_LEVEL=debug
  1. tail the logs
oc logs -f myrouter-x-xxxxx -c syslog
-- CBR
Source: StackOverflow