Query and view AO logs

After the log collector pulls data from various project components, the Observability platform aggregates logs from all log sources, adds indexes, and associates logs with labels according to the configuration for data observability. You can then query and view logs on the logs panel of the system monitoring instance.

Query and view logs on the logs panel

You can query logs through the user interface (UI) of the system monitoring instance of your project. The system monitoring instance includes project-level measures to monitor infrastructure components, such as CPU utilization, storage consumption, network monitoring, server monitoring, logs, alerts, and metrics from the GDCH components.

You can view logs on the logs panel of the system monitoring instance of your project. Then, you can make queries to view specific logs for data observability of your use case needs.

Before you begin

Before querying and viewing logs on the logs panel, you must obtain access to the system monitoring instance. For more information, see Get access to dashboards.

Build queries for your logs

Querying logs from the UI of the system monitoring instance lets you choose the data source to retrieve operational logs from your project and get an integrated view of your queries. To filter results, search for logs by labels using query language expressions. For example, you can set the cluster and namespace labels in your queries to the values that identify your cluster and project namespace, respectively.

System monitoring instance endpoint

The following URL is the endpoint of the monitoring instance of your project:

https://GDCH_URL/PROJECT_NAMESPACE/grafana

Replace the following:

  • GDCH_URL: the URL of your organization in GDCH
  • PROJECT_NAMESPACE: the namespace of your project

Query operational logs

Complete the following steps to retrieve operational logs:

  1. In the GDCH console, select a project.
  2. On the navigation menu, click Operations > Logging.
  3. Click View all in Grafana Loki.

    A new page opens the URL of the monitoring instance of your project.

  4. On the UI of the monitoring instance, click explore Explore from the navigation menu to open the Explore page.

  5. From the drop-down menu at the Explore bar, select Operational Logs as the data source to retrieve operational logs.

  6. Enter a query to search for logs by labels using LogQL (Log Query Language) expressions. You can do this step in either of the following ways:

    • Use the interactive query-builder UI. Then, click Run query.
    • Enter your query using LogQL expressions directly in the text field and press Shift+Enter to run the query.

    The page displays the logs matching your query.

After querying logs, you can export them. Click Export to download logs in plain text or CSV formats.

The Operational Logs option is selected on the Explore page of the UI to obtain operational logs.

Figure 1. Menu option to query logs from the UI of the system monitoring instance.

In figure 1, the Operational Logs option displays the interface that lets you build log queries from the UI to retrieve operational logs.

Sample queries and labels

The following are some of the default labels that you can use to query logs:

  • cluster: The name of the cluster
  • namespace: Your project namespace
  • node: The node name prefix
  • pod: The pod name prefix
  • container: The container name prefix

The following code samples show the use of labels and values to query different logs:

  • Select all logs from a project:

    {cluster="user-vm-1-cluster", namespace="PROJECT_NAMESPACE"}
    

    Replace PROJECT_NAMESPACE with the namespace of your project.

  • Select project logs from a service:

    {cluster="user-vm-1-cluster", namespace="PROJECT_NAMESPACE", container="my-service"}
    

    Replace PROJECT_NAMESPACE with the namespace of your project.