Skip to main content

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

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the request log

Example Requests

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']}")

Status Codes

CodeDescription
200Request log retrieved successfully
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Request log not found
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the request log
userObjectUser information (id, username, full_name) or null for anonymous
ipStringIP address of the request
deviceStringDevice name/model
device_typeStringType of device (pc, mobile, tablet)
is_botBooleanWhether the request was made by a bot
osStringOperating system information
browserStringBrowser information
schemeStringRequest scheme (http, https)
endpointStringAPI endpoint that was called
methodStringHTTP method used
status_codeIntegerHTTP response status code
exception_typeStringType of exception (if any occurred)
started_atString (ISO 8601)Timestamp when request started
finished_atString (ISO 8601)Timestamp when request finished
durationDecimalRequest duration in seconds
created_atString (ISO 8601)Timestamp when log entry was created
updated_atString (ISO 8601)Timestamp when log entry was last updated
query_paramsObjectJSON object containing request query parameters
bodyObjectJSON object containing request body data
responseObjectJSON object containing response data
request_headersObjectJSON object containing request headers
response_headersObjectJSON object containing response headers
exception_messageStringDetailed exception message (if exception occurred)
exception_tracebackStringFull 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