Monitor logs using Loki and Grafana

Kubernetes clusters typically store pod logs in /var/log/pods on each node. In Amazon EKS environments, accessing these logs can be inconvenient since it requires additional configuration to connect to the underlying nodes.

The VerticaDB Operator includes built-in integration with Loki, Alloy, and Grafana to simplify log collection and visualization. Alloy collects logs from your applications and sends them to Loki for storage and indexing. Grafana then connects to Loki as a data source, enabling you to query and visualize the collected logs.

Grafana, Loki, and Alloy work together to enable you to monitor your system, each handling a different part of the process:

  • Grafana provides visualization and dashboards. It connects to multiple data sources (such as Loki and Prometheus) to offer interactive, real-time monitoring and analysis.

  • Loki is a log aggregation system from Grafana Labs that collects, indexes, and stores logs from applications and infrastructure. It integrates seamlessly with Grafana, enabling you to query and visualize logs alongside metrics.

  • Alloy (formerly Grafana Agent) is a lightweight telemetry collector. It gathers metrics, logs, and traces from your environment and forwards them to backends like Loki (for logs), Prometheus (for metrics), and Tempo (for traces).

How log monitoring works

  1. Install VerticaDB operator with Loki, Alloy, and Grafana enabled.

  2. Deploy VerticaDB with opentext/vertica-logger as a sidecar.

    The logger redirects vertica.log to a standard output for log aggregation. For example:

    apiVersion: vertica.com/v1
    kind: VerticaDB
    metadata:
      name: demodb
    spec:
      sidecars:
        - name: vlogger
          image: opentext/vertica-logger:latest
      subclusters:
        - name: sc1
          size: 3
          type: primary
    
  3. View Grafana Logs Drilldown

    Open the Grafana UI in a browser and then navigate to Drilldown > Logs.

    • Vertica.log

      In the Labels dropdown list, select the vlogger container inside the database pod as the instance. You can view the details of your database logs.

    • VerticaDB Operator log

      In the Labels dropdown list, select the manager container inside the verticadb-operator-manager pod as the instance. For example, verticadb-operator/verticadb-operator-manager-6f58dfdbd7-z8nxp:manager.

    • Pod events

      In the Labels dropdown list, select loki.source.kubernetes_events.cluster_events. You can use Fields to filter the events you want to monitor.

RBAC roles

After the operator is deployed with Loki and Alloy enabled, it automatically creates a cluster-wide role that grants Alloy minimal permissions to access, list, and monitor pods, events, and namespaces.