POST /mltk/container_logs

POST /mltk/container_logs

Fetch a container's stdout/stderr logs.

Description. Fetch a container's stdout/stderr logs. For Docker, calls docker_client.containers.get(container_id).logs(). For Kubernetes, delegates to K8SUtils.get_logs().

Body (JSON).

{ "payload": { "model": "my_model" } }

Response (200).

{
  "status":  "success",
  "message": "Fetched the logs of container successfully",
  "container_logs": {
    "entries": [
      { "_time": "2024-05-11T10:23:45.123Z", "log": "Application started on port 5000" },
      { "_time": "2024-05-11T10:23:46.456Z", "log": "Ready to serve" }
    ]
  }
}

Example.

curl -sk -u "$SPLUNK_USER:$SPLUNK_PASSWORD" -X POST 
  -H "Content-Type: application/json" 
  --data '{"payload":{"model":"my_model"}}' 
  "$SPLUNK_HOST/servicesNS/nobody/Splunk_ML_Toolkit/mltk/container_logs?output_mode=json"

Press Cmd/Ctrl+K to focus search. Esc to close.

Type to search the portal.