Fetch machine logs data
POST/api/v1/machines/:machineIdOrAlias/logs/query
This API endpoint retrieve logs data for the machine identified by the provided machineId or machine alias.Note that logs data is only collected if logs collection is enabled in machine telemetry. Machine logs are records of events and messages generated by the operating system, applications, and services running on a machine.
Request
Path Parameters
The machineId - unique id of the machine, alias - machine alias
- application/json
Body
required
The request body containing the required details to get machine logs
Timestamp in epoch nanoseconds
Timestamp in epoch nanoseconds
Possible values: <= 100
Responses
- 200
Success response
- application/json
- Schema
- Example (from schema)
- Fetch machine logs data example
Schema
Array [
]
payload
object
Schema for machine logs response
data
object
Schema for telemetry machine logs data
result
object[]
stream
object
Schema for telemetry machine logs stream
{
"success": true,
"message": "string",
"status": "string",
"statusCode": 0,
"errorCode": "string",
"subErrors": [
{}
],
"payload": {
"status": "string",
"data": {
"resultType": "string",
"result": [
{
"stream": {
"exporter": "string",
"machine_id": "string",
"stream_name": "string"
},
"values": [
[
{}
]
]
}
]
}
}
}
Fetch machine logs data response example
{
"success": true,
"message": "Machine logs fetched successfully",
"status": "OK",
"statusCode": 200,
"errorCode": "",
"subErrors": [
{}
],
"payload": {
"status": "success",
"data": {
"resultType": "streams",
"result": [
{
"stream": {
"exporter": "OTLP",
"machine_id": "xxb63e2aaedx-xxxx-123",
"stream_name": "log_stream"
},
"values": [
[
"1717750055593212998",
"{\"body\":\"metrics sent successfully\",\"severity\":\"INFO\",\"attributes\":{\"func\":\"export\",\"package\":\"grpc-server\"},\"resources\":{\"service.name\":\"mecha-agent-service\"},\"instrumentation_scope\":{\"name\":\"opentelemetry-appender-tracing\",\"version\":\"0.2.0\"}}"
],
[
"1717750055474976269",
"{\"body\":\"status message published!\",\"severity\":\"INFO\",\"attributes\":{\"func\":\"send_status\",\"package\":\"status\"},\"resources\":{\"service.name\":\"mecha-agent-service\"},\"instrumentation_scope\":{\"name\":\"opentelemetry-appender-tracing\",\"version\":\"0.2.0\"}}"
]
]
}
]
}
}
}