Question

We are running nginx as a reverse proxy that forwards requests to a Clojure application running Compojure, a library that wraps around Jetty and provides our application with the ability to service web requests.

We currently capture logs generated by both nginx and the Clojure application (via log4j to syslog). We are unable, however, to match an entry in the nginx log to an entry in the syslog output of the Clojure application.

We need to figure out a way to modify the request sent upstream to the Clojure app to include some kind of ID. This could be an integer, UUID, whatever.

Do you have any suggestions as to how best to accomplish this?

Thanks for your help!

Was it helpful?

Solution

Compojure is written on ring and ring has middleware :)

you would write a middleware called with-uuid that adds the UUID to the request map on the way in and to the reply on the way out.

OTHER TIPS

Of course the best approach would be an nginx module, duplicating the functionality of apache's mod_unique_id.

There doesn't seem to be one yet. Here's a patch that wants to graduate to a module someday.:

http://mailman.nginx.org/pipermail/nginx-devel/2011-June/001015.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top