Retrieve Request Log
Retrieves detailed information about a specific request log by its ID, including full request/response data and exception details.
HTTP Request
GET/api/metrics/request_logs/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff with RequestLogPermission or Admin
- Permission Code: 3601
- Authentication: Token authentication
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the request log |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Get detailed request log information
4response = requests.get('http://www.example.com/api/metrics/request_logs/12345', headers={
5 'Authorization': 'Token <your_api_key>'
6})
7print(response.json())
8
9# Example response handling
10if response.status_code == 200:
11 log_data = response.json()
12 print(f"Request to {log_data['endpoint']} took {log_data['duration']} seconds")
13 if log_data['exception_type']:
14 print(f"Exception occurred: {log_data['exception_type']}")1# Get detailed request log
2curl "http://www.example.com/api/metrics/request_logs/12345" \
3-H "Authorization: Token <your_api_key>"
4
5# Get request log with pretty formatting
6curl "http://www.example.com/api/metrics/request_logs/12345" \
7-H "Authorization: Token <your_api_key>" \
8-H "Accept: application/json" | jq '.'Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the request log |
| user | Object | User information (id, username, full_name) or null for anonymous |
| ip | String | IP address of the request |
| device | String | Device name/model |
| device_type | String | Type of device (pc, mobile, tablet) |
| is_bot | Boolean | Whether the request was made by a bot |
| os | String | Operating system information |
| browser | String | Browser information |
| scheme | String | Request scheme (http, https) |
| endpoint | String | API endpoint that was called |
| method | String | HTTP method used |
| status_code | Integer | HTTP response status code |
| exception_type | String | Type of exception (if any occurred) |
| started_at | String (ISO 8601) | Timestamp when request started |
| finished_at | String (ISO 8601) | Timestamp when request finished |
| duration | Decimal | Request duration in seconds |
| created_at | String (ISO 8601) | Timestamp when log entry was created |
| updated_at | String (ISO 8601) | Timestamp when log entry was last updated |
| query_params | Object | JSON object containing request query parameters |
| body | Object | JSON object containing request body data |
| response | Object | JSON object containing response data |
| request_headers | Object | JSON object containing request headers |
| response_headers | Object | JSON object containing response headers |
| exception_message | String | Detailed exception message (if exception occurred) |
| exception_traceback | String | Full exception traceback (if exception occurred) |
Example Response
{
"id": 1,
"user": null,
"ip": "127.0.0.1",
"device": "Other",
"device_type": "pc",
"is_bot": false,
"os": "Windows",
"browser": "Firefox",
"scheme": "http",
"endpoint": "/superadmin/",
"method": "GET",
"status_code": 302,
"exception_type": null,
"started_at": "2025-11-19T14:55:32.673075Z",
"finished_at": "2025-11-19T14:55:32.789033Z",
"duration": 0.115958,
"created_at": "2025-11-19T14:55:32.789379Z",
"updated_at": "2025-11-19T14:55:32.789382Z",
"query_params": {},
"body": null,
"response": null,
"request_headers": {
"Host": "127.0.0.1:8000",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Cookie": "csrftoken=EqfXUxesM4u9XZc0UiptOMBL1mTRb8DA; sessionid=yf1pql5k3vvl6udi00fz1y5hzdriaur9",
"Priority": "u=0, i",
"Connection": "keep-alive",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0",
"Content-Type": "text/plain",
"Content-Length": "",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Accept-Language": "en-US,en;q=0.5",
"Upgrade-Insecure-Requests": "1"
},
"response_headers": {
"Vary": "Accept-Language, Cookie",
"Expires": "Wed, 19 Nov 2025 14:55:32 GMT",
"Location": "/superadmin/login/?next=/superadmin/",
"Content-Type": "text/html; charset=utf-8",
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate, private",
"Server-Timing": "TimerPanel_utime;dur=62.012000000000064;desc=\"User CPU time\", TimerPanel_stime;dur=29.42600000000001;desc=\"System CPU time\", TimerPanel_total;dur=91.43800000000007;desc=\"Total CPU time\", TimerPanel_total_time;dur=105.6888599996455;desc=\"Elapsed time\", SQLPanel_sql_time;dur=1.919169999382575;desc=\"SQL 2 queries\", CachePanel_total_time;dur=2.0399810000526486;desc=\"Cache 1 Calls\"",
"Content-Length": "0",
"Referrer-Policy": "same-origin",
"X-Frame-Options": "DENY",
"djdt-request-id": "3e89467baded4ad498cf46ee313585fb",
"Content-Language": "en-us",
"X-Content-Type-Options": "nosniff",
"Cross-Origin-Opener-Policy": "same-origin"
},
"exception_message": null,
"exception_traceback": null
}
Notes
- This endpoint provides comprehensive logging data for debugging and monitoring purposes
- The duration field is automatically calculated from started_at and finished_at timestamps
- Anonymous requests are stored with user: null and can be filtered using user=0 parameter
- All JSON fields (query_params, body, response, etc.) may contain null values if no data was captured
- Exception fields will be null for successful requests
- Request and response headers may contain sensitive information - ensure proper access controls are in place