Skip to main content
To work with logs in the terminal, you can use the logcli command-line tool. Take into account the limitations of our LogQL implementation.

Prerequisites

  1. Install and configure Nebius AI Cloud CLI.
  2. If you don’t have a service account for observability services, create one.
  3. Make sure that the service account is in a group that has at least the viewer role within your tenant; for example, the default viewers group. You can check this in the Administration → IAM section of the web console. If the service account is not in the required group, click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/button-vellipsis.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e80b8e57c43bfd117679262e6a1334ad → Add to group, and select viewers.
  4. Issue a static key for the service account using the following command:
    nebius iam static-key issue \
      --name <name_for_the_key> \
      --account-service-account-id <service_account_ID> \
      --service=OBSERVABILITY
    
    Copy the value of the static key from the token parameter of the response. You will need it on later steps.

Steps

  1. Download LogCLI binary for your platform from the Loki releases page.
  2. Unzip the binary and move it to a directory that is part of your $PATH.
  3. Save the static key that you got earlier to a LOKI_BEARER_TOKEN environment variable:
    export LOKI_BEARER_TOKEN=<static_key>
    
    Alternatively, get an access token for the current user of Nebius AI Cloud CLI:
    LOKI_BEARER_TOKEN=$(nebius iam get-access-token)
    
  4. Save the following URL to a LOKI_ADDR environment variable:
    export LOKI_ADDR=https://read.logging.api.nebius.cloud/projects/<project_ID>
    
    In the URL, specify your project ID.
  5. Run LogQL queries with logcli. Currently, the only supported label is __bucket__. It can have the following values:
    • sp_serial for serial logs of Compute virtual machines
    • sp_mlflow for Managed Service for MLflow logs
    • sp_postgres for Managed Service for PostgreSQL® logs
    • sp_cloudapps for Nebius Applications logs
    • default for your own logs
    For example, to review errors that occurred in a Managed Service for PostgreSQL cluster in the last 15 minutes, run the following command:
    logcli query '{__bucket__="sp_postgres"} |= `ERROR`' --since 15m
    
    Instead of using environment variables, you can provide the access token and the Logging URL when you run the command:
    logcli query '{__bucket__="sp_postgres"} |= `ERROR`' \
      --since 15m \
      --bearer-token=$(nebius iam get-access-token) \
      --addr=https://read.logging.api.nebius.cloud/projects/<project_ID>
    

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.