Get Logs
Use this api to search filter log.
Flow: The service selects a collection from the entity or from time to query log, then returns data.
URL : /api-auth/get
Method : GET
Authorization : Use OAuth token
Params : /api-auth/get?size=1000&more_detail=1&log_level=info,important,warning,error&entity_value=6471205381&entity_type=order_number&search_related=1
Validate Rule
'service' => ['nullable', 'string'],
'from' => ['nullable', 'date'],
'to' => ['nullable', 'date'],
'log_level' => ['nullable', 'string'], // default: 'error', 'important', 'warning'
'more_detail' => ['nullable', 'int'], // default: 0
'size' => ['nullable', 'int'], // default: 50, limit: 1000
'view_level' => ['nullable', 'int'],
'page' => ['nullable', 'int'],
'causer_kind' => ['nullable', 'int'],
'causer_type' => ['nullable', 'string'],
'entity_type' => ['nullable', 'string'],
'entity_value' => ['nullable', 'string'],
'search' => ['nullable', 'string'],
'search_related' => ['nullable', 'int'] // default: 0
Success Response
Code : 200 OK
Content example
{
"success": true,
"errors": null,
"errorCode": null,
"data": {
"total": 91,
"logs": [
{
"id": "6508fd378bb03a353103f91c",
"related_id": "6508f349c0f87de13d0c5c79",
"log_level": "info",
"entity": {
"order_number": "6471205381"
},
"event": "App\\Jobs\\OrderProcessingJob->updateOrCreateVoucher()",
"message": "Proccessing Voucher",
"log": "{\"amount\":40000,\"code\":\"SEP40K\",\"point_used\":0,\"payment_code\":1998,\"type\":\"pharmacity\"}",
"causer_kind": 1,
"causer": "816932",
"causer_name": "Phan Võ Quốc Bình",
"view_level": 1,
"properties": [],
"service": "pmc-oms-order-manage-api",
"created_at": "2023-09-19T01:45:27.308000Z"
}
]
}
}
Search By Entity
Params : /api-auth/get?size=1000&more_detail=1&log_level=info,important,warning,error&entity_value=6471205381&entity_type=order_number&search_related=1
Search By Time
Params : /api-auth/get?from=2023-09-19 7:00:00&size=100&log_level=info,important,warning,error
Note: Service select the collection to search by from date, and it only search in that collection. If you want to search in another collection, change from param. If you not define from date, service will search from last 15 minute.
Search By Key word
Params : /api-auth/get?from=2023-09-19 7:00:00&size=100&log_level=info,important,warning,error&search=create
Note: Service will search key word in column: entity_value, message, log
Search By Service
Params : /api-auth/get?from=2023-09-19 7:00:00&size=1000&more_detail=1&log_level=info,important,warning,error&service=pmc-oms-order-api
Error Response
Code : 400 BAD REQUEST
Content :
{
"success": false,
"errors": {
"from": [
"The from is not a valid date."
]
},
"errorCode": 400,
"data": null
}
cURL
curl --location 'https://api-gateway.dev.pharmacity.io/pmc-ecm-logs-api/api-auth/get?size=100&more_detail=1&log_level=info%2Cimportant%2Cwarning%2Cerror&entity_value=6369051979&entity_type=order_number&search_related=1' \
--header 'Authorization: Bearer eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJjcmF0IjoxNjk1MDk0MjE5LCJoYXNoIjoiMzRlNWYwMjUzMDdmZDE2OGJhY2Q3ODNiOWM1MjMwZjgiLCJ1c2VyIjp7ImlkIjo3Miwia2luZCI6MSwiaXNfYWRtaW4iOmZhbHNlLCJyb2xlcyI6eyIxIjoiMDExMDEwMSIsIjE4IjoiMDEwMDAwMDAwMDAwMCIsIjE5IjoiMDAwMDAwMSIsIjIiOiIwMTAwMDAxMSIsIjIzIjoiMSIsIjI0IjoiMSIsIjI3IjoiMSIsIjI4IjoiMSIsIjI5IjoiMSIsIjMiOiIwMTExMTAxMSIsIjMwIjoiMDExMSIsIjMyIjoiMSIsIjMzIjoiMSIsIjM0IjoiMSIsIjM1IjoiMSIsIjM2IjoiMSIsIjM3IjoiMSIsIjM4IjoiMSIsIjQiOiIwMTExMTAiLCI0MCI6IjAwMDAwMDEiLCI0MyI6IjAxMTEiLCI0OSI6IjEiLCI1IjoiMSIsIjUwIjoiMSIsIjU2IjoiMDExMTExMTExMSIsIjU3IjoiMSIsIjU4IjoiMSIsIjU5IjoiMSIsIjYiOiIxIiwiNjAiOiIxIiwiNjEiOiIxIiwiNjIiOiIxIiwiNjQiOiIxIiwiNyI6IjAxMTExMTAwMDAwIn0sIm5hbWUiOiJMw6ogQsOhIFRp4bq_biIsImV4dGVybmFsX2lkIjoiODE3OTkzIiwiZXh0ZXJuYWxfZGF0YSI6eyJ1c2VyX2FnZW50IjoiUG9zdG1hblJ1bnRpbWUiLCJ1c2VyX2lkIjoiMTMzMTIifX19.adK7GMLXb9fBPjWkxolSfOmY1GH_JOA_d2VC8ynxKOthnSU9S-In9XQLm1FxaJ-LCZVSdMUSirUYONpW3LBeDw' \
--data ''