Logging 2.0

How to retrieve and filter the logs for your Orka environment. Administrators-only. API-only.

🚧

Quick navigation

On this page, jump to: Log types | Retrieving the logs | Filter and limit the logs | Caveats | Log example

Orka collects logs for all CLI and API operations. Administrators can view the logs. All logs are returned in Grafana Loki format suitable for consumption by Grafana. Using Grafana Loki allows querying logs using LogQL. Logs older than 2 weeks are automatically deleted.

Retrieving the logs is currently available only via the Orka API.

Log types

There are two types of logs - user logs and system logs.

User logs are all logs for requests made via the API and CLI by the users. To retrieve the user logs only, make sure to add log_type when you query logs. If the query parameter is not specified, user logs are returned by default.

http://<orka-api-url>/logs/query?logs20=true&limit=10 and
http://<orka-api-url>/logs/query?logs20=true&limit=10&query={log_type="user_logs"} both return user logs.

System logs are logs for requests used by Orka for health check and monitoring.

Retrieving the logs

Send a POST request to the http://<Orka-API-URL>/logs/query?logs20=true endpoint.

For example:

curl --location --request POST 'http://<orka-api-ip>/logs/query?logs20=true' \
--header 'Content-Type: application/json' \
--header 'orka-licensekey: <license-key>'

Replace <license-key> with your actual Orka license key.
Replace <orka-api-ip> with 10.221.188.20, 10.221.188.100, or your Orka domain, or your external custom domain. Note that for Orka and custom domains you need to switch to https.

Filter and limit the logs

Orka logging 2.0 allows filtering and limiting logs by using LogQL - the Grafana Loki query language. For full reference of all the filtering capabilities, review LogQL documentation. Below are some basic examples:

# Limit to 10 log items
'http://<orka-api-ip>/logs/query?logs20=true&limit=10'

# Get all logs after a certain date and time
'http://<orka-api-ip>/logs/query?logs20=true&start=2022-06-10T08:00:00Z'

# Get all logs containing the string 'logs-demo'
'http://<orka-api-ip>/logs/query?logs20=true&query={log_type="user_logs"}|~"logs-demo"'

# Get all logs containing the string 'logs-demo' and NOT containing the string "logs/query"
'http://<orka-api-ip>/logs/query?logs20=true&query={log_type="user_logs"}|~"logs-demo"!~"logs/query"'

Replace <orka-api-ip> with 10.221.188.20, 10.221.188.100, or your Orka domain, or your external custom domain. Note that for Orka and custom domains you need to switch to https.

Caveats

  • Log retrieval and management is available only to administrators and requires the passing of the orka-licensekey: <licensekey> header.
  • Log retrieval and management is available only from the Orka API.
  • (Orka 1.2.0 and later) The logs capture internal API calls from the Orka CLI, executed as part of running the specified user command. For example, the logs capture internal token checks and API version checks executed as part of VM-related operations.

Log example

Request:

curl --location -g --request POST 'http://<orka-api-ip>/logs/query?logs20=true&limit=10&query={log_type="user_logs"}|~"logs-demo"!~"logs/query"' \
--header 'Content-Type: application/json' \
--header 'orka-licensekey: <license-key>'

Response:

{
    "status": "success",
    "data": {
        "resultType": "streams",
        "result": [
            {
                "stream": {
                    "log_type": "user_logs",
                    "service": "orka-logs"
                },
                "values": [
                    [
                        "1655882542707086000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/deploy\",\"method\":\"POST\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"content-type\":\"application/json\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"content-length\":\"114\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{\"orka_vm_name\":\"logs-demo\",\"replicas\":1,\"vnc_console\":true,\"tag\":\"\",\"tag_required\":false,\"gpu_passthrough\":false}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"921\",\"etag\":\"W/\\\"399-VQLuUD6gTFPeeM9A+DE4RH/Y8RU\\\"\"},\"body\":{\"message\":\"Successfully deployed VM\",\"help\":{\"start_virtual_machine\":\"To start a VM send rest request to http://10.221.188.100/resources/vm/exec/start\",\"stop_virtual_machine\":\"To stop a VM send rest request to http://10.221.188.100/resources/vm/exec/stop\",\"resume_virtual_machine\":\"To resume a VM send rest request to http://10.221.188.100/resources/vm/exec/resume\",\"suspend_virtual_machine\":\"To suspend a VM send rest request to http://10.221.188.100/resources/vm/exec/suspend\",\"data_for_virtual_machine_exec_tasks\":{\"orka_vm_name\":\"logs-demo\",\"orka_node_name\":\"mini-4\"},\"virtual_machine_vnc\":\"Once started and deployed, you can use VNC to access it via 10.221.188.14:5999\"},\"errors\":[],\"ram\":\"16.00G\",\"vcpu\":\"3\",\"host_cpu\":\"3\",\"ip\":\"10.221.188.14\",\"ssh_port\":\"8822\",\"screen_share_port\":\"5900\",\"vm_id\":\"9f4eb035246ea\",\"port_warnings\":[],\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"vnc_port\":\"5999\"}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:22.705Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882538013370000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:18.012Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882538010136000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:18.007Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882537968642000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:17.966Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882537925258000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:17.923Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882537905286000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:17.900Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882537895210000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:17.893Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882537894907000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:17.892Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882536744112000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/configs/logs-demo\",\"method\":\"GET\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{}},\"response\":{\"statusCode\":200,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"390\",\"etag\":\"W/\\\"186-2055VqdFQ68CaSDuFgiuEzzRuAs\\\"\"},\"body\":{\"message\":\"\",\"help\":{},\"errors\":[],\"configs\":[{\"owner\":\"[email protected]\",\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_cpu_core\":3,\"vcpu_count\":3,\"iso_image\":\"None\",\"attached_disk\":\"None\",\"vnc_console\":true,\"io_boost\":true,\"use_saved_state\":false,\"gpu_passthrough\":false,\"system_serial\":\"N/A\",\"tag\":\"\",\"tag_required\":false,\"scheduler\":\"default\",\"memory\":\"automatic\"}]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:16.743Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ],
                    [
                        "1655882527512385000",
                        "{\"message\":{\"request\":{\"url\":\"/resources/vm/create\",\"method\":\"POST\",\"headers\":{\"accept\":\"application/json, text/plain, */*\",\"content-type\":\"application/json\",\"user-agent\":\"orka-cli\",\"x-cli-version\":\"2.1.0\",\"platform\":\"darwin\",\"release\":\"21.1.0\",\"content-length\":\"204\",\"host\":\"10.221.188.100\",\"connection\":\"close\"},\"body\":{\"orka_vm_name\":\"logs-demo\",\"orka_base_image\":\"90GBigSurSSH.img\",\"orka_image\":\"logs-demo\",\"vcpu_count\":3,\"orka_cpu_core\":3,\"orka_vm_config_template_name\":\"default\",\"vnc_console\":true,\"tag_required\":false,\"type\":\"user_vm_config\",\"io_boost\":true,\"scheduler\":\"default-scheduler\",\"use_saved_state\":false,\"gpu_passthrough\":false}},\"response\":{\"statusCode\":201,\"headers\":{\"access-control-allow-origin\":\"*\",\"content-type\":\"application/json; charset=utf-8\",\"content-length\":\"304\",\"etag\":\"W/\\\"130-26c8tLj/G/T361InTj/IcBZBEsY\\\"\"},\"body\":{\"message\":\"Successfully Created\",\"help\":{\"deploy_virtual_machine\":\"To deploy a VM, make sure you have a configuration created and use the endpoint http://10.221.188.100/resources/vm/deploy\",\"required_request_data_for_deploy\":{\"orka_vm_name\":\"logs-demo\",\"orka_node_name\":\"<ORKA_NODE_NAME>\"}},\"errors\":[]}},\"user\":{\"email\":\"[email protected]\",\"id\":\"dc440e6e-eacd-4a84-8800-cd153b4a5b58\"},\"createdAt\":\"2022-06-22T07:22:07.511Z\",\"level\":\"info\",\"logVersion\":\"2.0\"}}"
                    ]
                ]
            }
        ],
        "stats": {
            "summary": {
                "bytesProcessedPerSecond": 108452,
                "linesProcessedPerSecond": 119,
                "totalBytesProcessed": 16317,
                "totalLinesProcessed": 18,
                "execTime": 0.150453634
            },
            "store": {
                "totalChunksRef": 0,
                "totalChunksDownloaded": 0,
                "chunksDownloadTime": 0,
                "headChunkBytes": 0,
                "headChunkLines": 0,
                "decompressedBytes": 0,
                "decompressedLines": 0,
                "compressedBytes": 0,
                "totalDuplicates": 0
            },
            "ingester": {
                "totalReached": 16,
                "totalChunksMatched": 1,
                "totalBatches": 1,
                "totalLinesSent": 10,
                "headChunkBytes": 15255,
                "headChunkLines": 16,
                "decompressedBytes": 1062,
                "decompressedLines": 2,
                "compressedBytes": 682,
                "totalDuplicates": 0
            }
        }
    }
}

© 2019-2023 Copyright MacStadium, Inc. – Documentation built with readme.com. Orka is a registered trademark of MacStadium, Inc.