Overview
Grafana Loki is a horizontally scalable, multi-tenant log aggregation system. Control Plane can forward all Org logs natively to any Loki-compatible target — a self-hosted Loki, Grafana Cloud Logs, or any backend that accepts the Loki push API — using the native Loki output rather than a generic protocol. Because logs are sent over the native Loki API, Control Plane log metadata is attached as indexed Loki labels (includingservice_name, which drives Grafana’s service detection), so logs are immediately queryable by workload, GVC, location, and more.
Follow the steps below to configure log shipping to Loki.
Step 1 - Prerequisites
- Endpoint: A reachable URL for your Loki instance (see Endpoint Format).
- Authentication (optional): A Username & Password Secret for HTTP basic auth, if your Loki target requires it (Grafana Cloud and most hosted Loki services do).
- Tenant ID (optional): The tenant identifier for multi-tenant Loki deployments (for example, the user/instance ID for Grafana Cloud).
Step 2 - Configure External Logging
External logging can be configured by using either the UI Console or CLI.Enable Logging using the UI Console
- From the Control Plane Console UI, click on
Orgin the left menu. - Click
External Logsin the middle context menu. - Select
Lokiand fill out the endpoint, and the credentials and tenant ID if your target requires them. - Click
Save. - After the configuration is complete, log entries will begin forwarding to Loki within a few minutes.
Enable Logging using the CLI
The external logging configuration can be created / updated using the CLI’scpln org patch ORG_NAME -f FILE.yaml command.
Below is an example of an Org manifest (in YAML). Edit and save the YAML as a file and use it as an input to the CLI’s cpln org patch ORG_NAME -f FILE.yaml command.
- Substitute:
ORG_NAME, theendpoint, and (if required)USERPASS_SECRETandtenantId.
YAML
credentials and tenantId are both optional. Provide whichever your target requires (or neither for an unauthenticated, single-tenant endpoint).
Endpoint Format
Theendpoint is required. TLS, the port, and the push path are derived from its format:
| Endpoint | TLS | Port | Push URI |
|---|---|---|---|
https://host[:port][/path] | On | From URL, else 443 | The URL path, else /loki/api/v1/push |
http://host[:port][/path] | Off | From URL, else 80 | The URL path, else /loki/api/v1/push |
host[:port] | On | As given, else 443 | /loki/api/v1/push |
Authentication
If your Loki target requires authentication, setcredentials to a Username & Password Secret. The username and password are sent as HTTP basic auth on every push request. For Grafana Cloud, the username is your instance/user ID and the password is a Grafana Cloud access token.
Omit credentials for an unauthenticated endpoint, such as a Loki instance reachable only on a trusted internal network.
Multi-Tenant Loki
For multi-tenant Loki deployments, settenantId to the tenant the logs should be written under. It is sent as the tenant ID on each push request. Leave it unset for single-tenant Loki.
Forwarded Log Labels
Each forwarded record carries the Control Plane log metadata as indexed Loki labels, and the log message body as the log line:| Label | Description |
|---|---|
service_name | Workload name (drives Grafana service detection) |
workload | Workload name |
org | Org name |
gvc | GVC name |
location | Location the log originated from |
provider | Cloud provider |
version | Workload version |
container | Container name |
stream | Output stream (stdout or stderr) |
replica | Replica name |
All logs continue to remain accessible through Control Plane, adhering to the current log retention policy.