Hi Robert,
sorry for the late reply, busy times, could not answer right away and then
lost it in the build
server failures storm that we have been into lately
On Tue, Mar 8, 2016 at 8:32 PM, Robert Coup <robert.c...@koordinates.com>
wrote:
> Hi folks,
>
> Just exploring the best way to go about this. We use a X-Request-ID header
> for tracing and logging requests through our application stack (from
> CDN/load balancers through to databases) and I'm exploring adding support
> this to GeoServer. The request ID values are UUIDs.
>
> ows.Request has a protected UUID identifier property, which doesn't seem
> to be used for much. So, I'm thinking:
>
> - Alter the Request class to make it settable
>
> Roger that... maybe with a system variable too? Like we would not want a
malicious user to pass the right header in a server that's not fronted by
something else
setting the x-request-id
>
> - Set it in a custom early Dispatcher init() callback from the header
> if present -- it would miss some of the request parsing but that's not the
> end of the world.
>
> Or the dispatcher itself could do it.
>
> - Add it to the logging MDC context in the same custom callback
>
> MDC... ? Ah:
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html
>
> - Use it in the logging output format from the MDC context so all log
> entries associated with that request are tagged with the ID
>
> Yes please, being able to tell apart logs from different requests would be
great
>
> -
> - Alter the monitor extension so that the audit log has access to
> Request.identifier, so the audit log can contain the ID too
>
> Yep
>
> - Get it through to the SQL session start/stop scripts so they can set
> it in postgres (via "SET application_name") -- maybe via EnvFunction a bit
> like GSUSER.
>
> Ok, why not
>
> - Postgres can log it for any SQL errors/slow-query traces/locks/etc
>
>
> 1. Obvious flaws? Am I missing an easier approach?
>
You should also create a ThreadLocalTransfer object so that the request id
gets preserved for requests triggering action
inside a thread pool, e.g., asynchronous WPS requests
> 2. Would the changes to Request and the Monitor extension likely be
> accepted as a contribution?
>
I'd say so, yes
> 3. Is this behaviour that would be useful for others? If so, potentially a
> config option that enables extracting a value from a defined header and
> adding it to the logging context/environment early in Dispatcher itself.
>
I'd say it would be useful to everybody.
One small extra note, it could also be useful to have also have the request
id in the response header, so that
if I have a problematic request in the client, I can go and look for the id
and then grep the logs for just the log
lines pertaining to it.
Cheers
Andrea
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
-------------------------------------------------------
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel