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 or Admin
- 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 '.'Status Codes
| Code | Description |
|---|---|
| 200 | Request log retrieved successfully |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 404 | Request log not found |
| 500 | Internal server error |
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) |
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