views:

56

answers:

1

Hi,

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!

+2  A: 

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.

Arthur Ulfeldt
Hm. I'll try that. Where in the request would you recommend I write the UUID. The header? I've not played around with nginx config. I'm assuming I'd have to write some code in the config file to lift the UUID out of the header and then write it out with log_format and access_log?
jkndrkn