We use nginx as a reverse proxy to manage and access the Clojure Log Web Service (Java).
We can generate access_log and capture incoming headers using nginx just fine. Our Clojure app logs activity through log4j. The problem is that we cannot match the entry in access_log with the entry created by the application.
The application responds to access by sending response headers as well as the body. We are free to change these response headers. My initial thought was to generate a UUID corresponding to each web service request and send it back to the user in the X-Uuid response header. My thought was that I could capture this answer by creating a custom log_format :
log_format lt-custom '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" $request_time $http_x_uuid';
This is similar to nginx being able to capture the headers of incoming requests but not outgoing responses (I checked this by replacing $http_x_uuid with $http_content_type ).
So! Is there a way to bind my access_log enties and my access_log entries by capturing the outgoing response headers using nginx? Is there a better way? I would prefer not to rely on users generating their own UUIDs.
Many thanks!
java logging web-services clojure nginx
jkndrkn
source share