Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
request-id-django-log
Advanced tools
pip install request-id-django-log
Update your INSTALLED_APPS
and MIDDLEWARE
INSTALLED_APPS = [
...
"request_id_django_log",
]
MIDDLEWARE = [
...
"request_id_django_log.middleware.RequestIdDjangoLog",
]
The following options are used by this library:
REQUEST_ID_CONFIG = {
"REQUEST_ID_HEADER": "HTTP_X_REQUEST_ID",
"GENERATE_REQUEST_ID_IF_NOT_FOUND": True,
"RESPONSE_HEADER_REQUEST_ID": "HTTP_X_REQUEST_ID",
}
REQUEST_ID_HEADER
is the header name which will hold the received request_id. This must be used when another system is responsible for generating the request_ids and sending them to your django application.GENERATE_REQUEST_ID_IF_NOT_FOUND
If set to true, a new request_id will be generated if none was previously supplied.RESPONSE_HEADER_REQUEST_ID
sets the name of the response header which will hold the value of the request_id.With this configuration if the request have the header X-REQUEST-ID
the library will use this header value.
If you want your logs to have the request id, add the following lines to your logging dictionary configuration:
LOGGING = {
...
"filters": {"request_id": {"()": "request_id_django_log.filters.RequestIDFilter"}},
"formatters": {
"standard": {
...
"format": "%(levelname)-8s [%(asctime)s] [%(request_id)s] %(name)s: %(message)s",
},
...
},
"handlers": {
"console": {
...
"filters": ["request_id"],
...
}
},
"loggers": {
"": {"level": "INFO", "handlers": ["console"]},
...
},
}
python 2.7
with Django 1.8
, 1.9
and 1.11
python 3.5
, 3.6
and 3.7
with Django 1.8
, 1.9
, 1.11
, 2.0
, 2.1
, 2.2
and 3.0
FAQs
A simple way to implement request_id in Django
We found that request-id-django-log demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.