drf-api-tracking icon indicating copy to clipboard operation
drf-api-tracking copied to clipboard

Log custom headers

Open lerela opened this issue 5 years ago • 3 comments

Some requests might include additional, useful information about the client in some custom HTTP header, say X-Client-Name and X-Client-Version. There is no way to currently get that information.

I see two main approaches, both based on a JSON field to store headers (that would restrict this feature to the DB backends that support JSON fields, but it's already been suggested to use them in #2):

  • Should we log all headers? This could significantly increase the size of a log entry.
  • Should we allow the user to specify which headers he's interested in? In settings? This requires some setup but allows to target only useful headers, so that's my favorite approach so far.

lerela avatar Aug 14 '20 21:08 lerela

I think having an option in settings to determine a list of headers to store.

Also I think storing this data is a json field is the most flexible. Django 3.1 now supports JSONfields for all db backends: https://docs.djangoproject.com/en/3.1/releases/3.1/#jsonfield-for-all-supported-database-backends

lingster avatar Sep 05 '20 20:09 lingster

+1

cyberbudy avatar Oct 11 '20 07:10 cyberbudy

It's realy important feature.

honeydev avatar May 21 '21 06:05 honeydev