Skip to main content
Version: 3.2

Loki

Cribl LogStream can send log events to Grafana's Loki log aggregation system. This is a streaming Destination type.

Configuring Cribl LogStream to Output to Loki

In the QuickConnect UI: Click + Add beside Destinations. From the resulting drawer's tiles, select Loki. Next, click either + Add New or (if displayed) Select Existing. The resulting drawer will provide the following options and fields.

Or, in the Data Routes UI: From the top nav of a LogStream instance or Group, select Data > Destinations. From the resulting page's tiles or the Destinations left nav, select Loki. Next, click + Add New to open a New Destination modal that provides the following options and fields.

General Settings

Output ID: Enter a unique name to identify this Loki output definition.

Loki URL: The endpoint to send events to, e.g.: https://logs-prod-us-central1.grafana.net.

Backpressure behavior: Whether to block, drop, or queue events when all receivers are exerting backpressure.

Authentication

Use the Authentication type buttons to select one of these options:

  • None: Don't use authentication.

  • Auth token: Use HTTP token authentication. In the resulting Token field, enter the bearer token that must be included in the HTTP authorization header.

  • Auth token (text secret): This option exposes a drop-down in which you can select a stored text secret that references the bearer token described above. A Create link is available to store a new, reusable secret.

  • Basic: This default option displays fields for you to enter HTTP Basic authentication credentials. Username is the Loki User. Password is your API key in the Grafana Cloud domain.

  • Basic (credentials secret): This option exposes a Credentials secret drop-down, in which you can select a stored text secret that references the Basic authentication credentials described above. A Create link is available to store a new, reusable secret.

Persistent Queue Settings

This section is displayed when the Backpressure behavior is set to Persistent Queue.

Max file size: The maximum size to store in each queue file before closing it. Enter a numeral with units of KB, MB, etc. Defaults to 1 MB.

Max queue size: The maximum amount of disk space the queue is allowed to consume. Once this limit is reached, queueing is stopped and data blocking is applied. Enter a numeral with units of KB, MB, etc.

Queue file path: The location for the persistent queue files. This will be of the form: your/path/here/<worker-id>/<output-id>. Defaults to: $CRIBL_HOME/state/queues.

Compression: Codec to use to compress the persisted data, once a file is closed. Defaults to None. Gzip is also available.

Queue-full behavior: Whether to block or drop events when the queue is exerting backpressure (because disk is low or at full capacity). Block is the same behavior as non-PQ blocking, corresponding to the Block option on the Backpressure behavior drop-down. Drop new data throws away incoming data, while leaving the contents of the PQ unchanged.

Processing Settings

Loki uses labels to define separate streams of logging data. This is a key concept. Cribl recommends that you familiarize yourself with the information and documentation Grafana provides about labels in Loki.

One canonical example is processing logs from servers in three environments: production, staging, and testing. You could create a label named env whose possible values are prod, staging, and test.

One basic principle is that if you set too many labels, you can end up with too many streams.

Post‑Processing

Pipeline: Pipeline to process data before sending the data out using this output.

System fields: A list of fields to automatically add to log events as labels. Supports wildcards.

By default, includes cribl_host (LogStream Node that processed the event) and cribl_wp (LogStream Worker Process that processed the event). On the Loki side, this creates different streams, which prevents Loki from rejecting some events as being out of order when different Nodes or Worker Processes are emitting at different rates.

Other options include:

  • cribl_pipe – LogStream Pipeline that processed the event.
  • cribl_input – LogStream Source that processed the event.
  • cribl_output – LogStream Destination that processed the event.

Advanced Settings

Compress: When the Message format is JSON, you can toggle this slider to Yes to GZIP-compress the data before sending to Loki. (When the Message format is Protobuf, data is always Snappy-compressed, so this slider is hidden.)

Round-robin DNS: Toggle to Yes to use round-robin DNS lookup. When a DNS server returns multiple addresses, this will cause LogStream to cycle through them in the order returned.

Validate server certs: Reject certificates that are not authorized by a CA in the CA certificate path, or by another trusted CA (e.g., the system's CA). Defaults to No.

Request timeout: Amount of time (in seconds) to wait for a request to complete before aborting it. Defaults to 30.

Request concurrency: Maximum number of concurrent requests before blocking. This is set per Worker Process. Defaults to 1.

Max body size (KB): Maximum size of the request body. Defaults to 4096 KB.

Max events per request: Maximum number of events to include in the request body. The 0 default allows unlimited events.

Flush period (sec): Maximum time between requests. Low values could cause the payload size to be smaller than its configured maximum. Defaults to 15.

Extra HTTP headers: Name/Value pairs to pass as additional HTTP headers.

Message format: Whether to send events as Protobuf (the default) or JSON.

Logs message field: The event field to send as log output, for example: _raw. All other event fields are discarded. If left blank, LogStream sends a JSON or Protobuf representation of the whole event.

Logs labels: Name/value pairs where the value can be a static or dynamic expression that has access to all log event fields.