Skip to main content

Correlation IDs in Django for debugging requests

Project description

Django Correlation IDs

.. image::

.. image::

Logging is important. Anyone who has had a call at 3am to say the site is down
knows this. Without quality logging it is almost impossible to work out what
on earth is happening.

Even with plenty of logs it can be hard to track down exactly what the effects
of a particular request are. Enter Django Correlation IDs. The approach
is quite a simple one. Incoming requests are assigned a unique id (a uuid).
This can either happen in say your public facing web server (e.g. nginx) or be
applied as soon as it hits django.

This ``cid`` is then available throught the django request/response cycle. We
provide filters for logging witch adds the ``cid`` to the logging record so you
can add it to your formatting string. We also provide wrappers around all the
standard database backends which adds the ``cid`` as a comment before each SQL


* Processing/Generation of a correlation id
* Database wrappers to add correlation id to each sql call
* Logging filter to inject the correlation id into logs
* A template context processe to make correlation id available in templates
* Output correlation id as a header

Documentation can be found at:


0.1.0 (2014-08-05)

* First release on PyPI.

0.1.2 (2016-12-01)

* Made CID repsonse header configurable, and optional (thanks @dbaty)

0.2.0 (2016-12-06)

* Added support for Django 1.10 middleware (thanks @qbey)

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_cid-0.2.0-py2.py3-none-any.whl (8.9 kB) Copy SHA256 hash SHA256 Wheel 3.5 Dec 6, 2016
django-cid-0.2.0.tar.gz (6.7 kB) Copy SHA256 hash SHA256 Source None Dec 6, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page