Stephen Patten
Stephen Patten

Reputation: 6363

How to correlate the request and response for the purpose of logging

I'm using the Global filters to log the request/response which works fine, but now I'd like to embed a correlation ID (Guid) in both to that I may tie the 2 together. What's preferred way to do this?

Thank you, Stephen

Upvotes: 3

Views: 399

Answers (1)

kampsj
kampsj

Reputation: 3149

Not sure if you are taking about these but you could do this with ServiceStack Request and Response filters Sounds like you want to do something like this...

  1. Create the Guid in the Request Attribute Filter and save to db.
  2. While still in the request filter store that Guid in into the IHttpRequest.Items dictionary. This dictionary is for you to use for anything you want. It will be avilable to all the ServiceStack services.
  3. Access that Guid in the Response Attribute filter via the IHttpRequest variable and save response entry to database.

Upvotes: 4

Related Questions