Retrieve Data Logs
GET /api/v1/admins/data-logs
Description
Retrieves a comprehensive list of data logs based on specified filters such as date range, IP addresses, status codes, and more. This endpoint is useful for system administrators and developers to monitor and troubleshoot API usage and system behavior.
Query Parameters:
dataLogDateRange(optional): Filters the logs by a specific date range. Format:start_date,end_date(e.g.,2020-11-12,2022-11-15).logIpAddresses(optional): Filters logs by IP addresses.logStatusCodes(optional): Filters logs by HTTP status codes.logApiMethods(optional): Filters logs by API methods used (e.g., GET, POST).logTypes(optional): Filters logs by types. Supported types:SYSTEM,USER,PUBLIC_APP.logLevels(optional): Filters logs by severity levels. Supported LogLevel:LOG,INFO,DEBUG,ERROR.logSearch(optional): A generic search term to filter logs.logTraceIds(optional): Filters logs by specific trace IDs.order(optional): Specifies the order of the results. Available values:ASC,DESC.page(optional): Specifies the pagination page.limit(optional): Specifies the number of results per page.
Example Request:
curl -G "http://[base_url]/api/v1/admins/data-logs" \
-H "Authorization: Bearer [access_token]" \
-d "dataLogDateRange=2020-11-12,2022-11-15" \
-d "logIpAddresses=192.168.1.1" \
-d "logStatusCodes=200,404" \
-d "logApiMethods=GET,POST" \
-d "logTypes=USER,SYSTEM" \
-d "logLevels=ERROR,DEBUG" \
-d "logSearch=error" \
-d "logTraceIds=abc123" \
-d "order=DESC" \
-d "page=1" \
-d "limit=10"
Responses:
- 200 OK: Successfully retrieved the list of data logs. The response includes detailed information about each log entry that matches the filter criteria.
Example Response:
{
"dataLogs": [
{
"logId": "123",
"timestamp": "2023-01-15T09:00:00Z",
"ipAddress": "192.168.1.1",
"method": "POST",
"statusCode": 200,
"type": "USER",
"level": "ERROR",
"message": "Login attempt failed.",
"traceId": "abc123"
}
],
"totalItems": 100,
"totalPages": 10,
"currentPage": 1
}
Error Responses:
- 400 Bad Request: Incorrect or incomplete query parameters.
- 404 Not Found: No logs found based on the provided criteria.
- 403 Forbidden: The user does not have permission to view the logs.
LANGUAGE
CURL REQUEST
curl --request GET \
--url /api/v1/admins/data-logs \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!