0

I'm using linkerd and have to use global tunnel to proxy everything via localhost:4140. The problem is that this seems to cause loggly to stop working. As soon as the global tunnel is active, loggly doesn't receive any messages. How can I change it?

globalTunnel.initialize({
  host: 'localhost',
  port: 4140
});

I have seen, that I can pass a proxy variable in the config for the loggy instance.

var logglyStream = new Bunyan2Loggly(logglyConfig);

Thanks for the help.

Tino
  • 3,340
  • 5
  • 44
  • 74

2 Answers2

1

globalTunnel overrides all http requests, so assuming that the Loggly library uses the standard http library, further proxy configuration in the Loggly library is not necessary.

I think there may be two issues here:

Linkerd Routing Rules

linkerd needs routing rules to proxy to the outside internet. You'll need a dtab that recognizes host:port requests and routes them accordingly:

dtab: |
  /ip-hostport => /$/inet;
  /svc => /$/io.buoyant.hostportPfx/ip-hostport;

Confirm routing works with this command:

$ http_proxy=localhost:4140 curl -s -o /dev/null -w "%{http_code}" www.google.com:80
200

Loggly header processing

It appears that Loggly fails all requests that contain headers with forward slashes in them:

# working request:
$ curl -H "foo: bar" -s -o /dev/null -w "%{http_code}" logs-01.loggly.com
403

# failed request:
$ curl -H "foo: /bar" -s -o /dev/null -w "%{http_code}" logs-01.loggly.com
400

Linkerd sets several headers on outbound requests for tracing, service discovery, and context information. Some of those headers include strings with forward slashes.

To get around this, we have two options:

  1. Modify linkerd to clear headers on outbound requests. I've filed github.com/linkerd/linkerd/issues/1218 to track this work.
  2. Set up a proxy server to handle outbound requests for Loggly, as documented in https://github.com/loggly/loggly-jslogger#setup-proxy-for-ad-blockers. Then, assuming that service is set up at internal-nginx-proxy, you can use this routing rule:
dtab: |
  /svc/logs-01.loggly.com => /$/inet/internal-nginx-proxy/80;
siggy
  • 86
  • 4
0

I'm not familiar with linkerd but it sends logs to logs-01.loggly.com either on port 80 or 443 for secure. Is that proxied through your tunnel?

mostlyjason
  • 138
  • 4