Skip to content

Loki

Connect HolmesGPT to Loki for log analysis through Grafana or direct API access. Provides access to historical logs and advanced log queries.

When to Use This

  • ✅ Your Kubernetes logs are centralized in Loki
  • ✅ You need historical log data beyond what's in pods
  • ✅ You want advanced log search capabilities

Prerequisites

  • Loki instance with logs from your Kubernetes cluster
  • Grafana with Loki datasource configured (recommended) OR direct Loki API access
Important: Disable Default Logging Toolset

Only one logging toolset should be enabled at a time. If you enable this toolset, disable the default kubernetes/logs toolset.

Available Log Sources:

💡 Choose one: Only enable one logging toolset at a time for best performance.

Configuration

Choose one of the following methods:

Required: - Grafana service account token with Viewer role - Loki datasource UID from Grafana

Find your Loki datasource UID:

# Port forward to Grafana
kubectl port-forward svc/grafana 3000:80

# Get Loki datasource UID
curl -s -u admin:admin http://localhost:3000/api/datasources | jq '.[] | select(.type == "loki") | .uid'

Configuration (Grafana Proxy)

Add the following to ~/.holmes/config.yaml. Create the file if it doesn't exist:

toolsets:
  grafana/loki:
    enabled: true
    config:
      api_key: <your grafana API key>
      url: https://xxxxxxx.grafana.net # Your Grafana cloud account URL
      grafana_datasource_uid: <the UID of the loki data source in Grafana>

  kubernetes/logs:
    enabled: false # HolmesGPT's default logging mechanism MUST be disabled

When using the standalone Holmes Helm Chart, update your values.yaml:

toolsets:
  grafana/loki:
    enabled: true
    config:
      api_key: <your grafana API key>
      url: https://xxxxxxx.grafana.net # Your Grafana cloud account URL
      grafana_datasource_uid: <the UID of the loki data source in Grafana>

  kubernetes/logs:
    enabled: false # HolmesGPT's default logging mechanism MUST be disabled

Apply the configuration:

helm upgrade holmes holmes/holmes --values=values.yaml

When using the Robusta Helm Chart (which includes HolmesGPT), update your generated_values.yaml:

holmes:
  toolsets:
    grafana/loki:
      enabled: true
      config:
        api_key: <your grafana API key>
        url: https://xxxxxxx.grafana.net # Your Grafana cloud account URL
        grafana_datasource_uid: <the UID of the loki data source in Grafana>

    kubernetes/logs:
      enabled: false # HolmesGPT's default logging mechanism MUST be disabled

Apply the configuration:

helm upgrade robusta robusta/robusta --values=generated_values.yaml --set clusterName=<YOUR_CLUSTER_NAME>

Direct Connection

The toolset can directly connect to a Loki instance without proxying through a Grafana instance. This is done by not setting the grafana_datasource_uid field. Not setting this field makes HolmesGPT assume that it is directly connecting to Loki.

Configuration (Direct Connection)

Add the following to ~/.holmes/config.yaml. Create the file if it doesn't exist:

toolsets:
  grafana/loki:
    enabled: true
    config:
      url: http://loki.logging
      headers:
        X-Scope-OrgID: "<tenant id>" # Set the X-Scope-OrgID if loki multitenancy is enabled

  kubernetes/logs:
    enabled: false # HolmesGPT's default logging mechanism MUST be disabled

When using the standalone Holmes Helm Chart, update your values.yaml:

toolsets:
  grafana/loki:
    enabled: true
    config:
      url: http://loki.logging
      headers:
        X-Scope-OrgID: "<tenant id>" # Set the X-Scope-OrgID if loki multitenancy is enabled

  kubernetes/logs:
    enabled: false # HolmesGPT's default logging mechanism MUST be disabled

Apply the configuration:

helm upgrade holmes holmes/holmes --values=values.yaml

When using the Robusta Helm Chart (which includes HolmesGPT), update your generated_values.yaml:

holmes:
  toolsets:
    grafana/loki:
      enabled: true
      config:
        url: http://loki.logging
        headers:
          X-Scope-OrgID: "<tenant id>" # Set the X-Scope-OrgID if loki multitenancy is enabled

    kubernetes/logs:
      enabled: false # HolmesGPT's default logging mechanism MUST be disabled

Apply the configuration:

helm upgrade robusta robusta/robusta --values=generated_values.yaml --set clusterName=<YOUR_CLUSTER_NAME>

Advanced Configuration

SSL Verification

For self-signed certificates, you can disable SSL verification:

Add the following to ~/.holmes/config.yaml. Create the file if it doesn't exist:

toolsets:
  grafana/loki:
    enabled: true
    config:
      url: https://loki.internal
      verify_ssl: false  # Disable SSL verification (default: true)

When using the standalone Holmes Helm Chart, update your values.yaml:

toolsets:
  grafana/loki:
    enabled: true
    config:
      url: https://loki.internal
      verify_ssl: false  # Disable SSL verification (default: true)

Apply the configuration:

helm upgrade holmes holmes/holmes --values=values.yaml

When using the Robusta Helm Chart (which includes HolmesGPT), update your generated_values.yaml:

holmes:
  toolsets:
    grafana/loki:
      enabled: true
      config:
        url: https://loki.internal
        verify_ssl: false  # Disable SSL verification (default: true)

Apply the configuration:

helm upgrade robusta robusta/robusta --values=generated_values.yaml --set clusterName=<YOUR_CLUSTER_NAME>

External URL

If HolmesGPT accesses Loki through an internal URL but you want clickable links in results to use a different URL:

Add the following to ~/.holmes/config.yaml. Create the file if it doesn't exist:

toolsets:
  grafana/loki:
    enabled: true
    config:
      url: http://loki.internal:3100  # Internal URL for API calls
      external_url: https://loki.example.com  # URL for links in results

When using the standalone Holmes Helm Chart, update your values.yaml:

toolsets:
  grafana/loki:
    enabled: true
    config:
      url: http://loki.internal:3100  # Internal URL for API calls
      external_url: https://loki.example.com  # URL for links in results

Apply the configuration:

helm upgrade holmes holmes/holmes --values=values.yaml

When using the Robusta Helm Chart (which includes HolmesGPT), update your generated_values.yaml:

holmes:
  toolsets:
    grafana/loki:
      enabled: true
      config:
        url: http://loki.internal:3100  # Internal URL for API calls
        external_url: https://loki.example.com  # URL for links in results

Apply the configuration:

helm upgrade robusta robusta/robusta --values=generated_values.yaml --set clusterName=<YOUR_CLUSTER_NAME>

Capabilities

Tool Name Description
fetch_pod_logs Fetches pod logs from Loki