Re: Allow gorouter to log random headers.

Shannon Coen

I don't see the difference between WAKAWAKA and X-Cf-Requestid. Gorouter
would have to add some header with a uuid for the request. Your apps have
to have logic to pass this header on, so that a log search returns the
original request as well as subsequent requests between apps. Could you
please clarify?

Thank you,

Shannon Coen
Product Manager, Cloud Foundry
Pivotal, Inc.

On Tue, Jul 21, 2015 at 11:09 AM, Simon Johansson <simon(a)>

Sure that header can be used. But then we are adding CF specific stuff
into the implementation of our services, which is something we want to
avoid at all costs.
Also Im not entirely sure if all the libraries we use for Zipkin supports
using custom headers.

All our public apps are fronted by different CDNs, which sets headers that
we might want to store for debugging, so we still need a way to pass those
trough into the log.

On Tuesday, 21 July 2015, Shannon Coen <scoen(a)> wrote:

Hello Simon,

The X-Cf-Requestid header already provides a uuid. Couldn't app "a" add
the value of X-Cf-Requestid to a header of your choosing? Call it WAKAWAKA
or X-Random-Header, but it doesn't need to be a platform standard. Wouldn't
a search for the value of X-Cf-Requestid then provide the desired results?

Thank you,

Shannon Coen
Product Manager, Cloud Foundry
Pivotal, Inc.

On Tue, Jul 21, 2015 at 6:06 AM, Simon Johansson <
simon(a)> wrote:


We have some devs who want to be able to trace a request troughout their

user -> a -> b -> c
|-> d -> e

When a user makes a request to "a" uuid is generated inside the app, and
the request to "b" from "a" will set a header(call it WAKAWAKA to uuid),
"b"'s call will passthrough WAKAWAKA to "c" and "d", "d" will passthrough
WAKAWAKA to "e". Etc.

We aggregate all RTR logs into ELK so it would be super helpful to them
to be able to filter on WAKAWAKA and get all the access logs(and app logs
aswell, they mostly use GELF so its easy for them to add whatewher field
they want) from the services involved.

I had a quick peek at the gorouter(
and it seems like this should be a simple PR.

1. To gorouter.yml add
- X-Random-Header

2. In makeRecord at the bottom add something like(in psuedo)

data = {}
for header in passthrough_headers:
header_val = r.FormatRequestHeader("X-Forwarded-For")
if header_val:
passthrough_headers[header] = header_val

if data:
fmt.Fprintf(b, data.to_stringified_json())

That would yield a log line like - [21/07/2015:10:17:05 +0000] "GET
HTTP/1.1" 200 0 17 "-" "NING/1.0" x_forwarded_for:"-"
response_time:0.004927106 app_id:9784cd03-050d-4b74-9e90-5f17134a3f08
{"WAKAWAKA": "Space is the place", "X-Random-Header": "Once upon a midnight
dreary, while I pondered weak and weary"}

The reason for a stringified JSON is to make it easy to parse with
logstash or other loganalysis tools.

Before I spend time implementing, is this something you would merge?

cf-dev mailing list

cf-dev mailing list

Join { to automatically receive all group messages.