Log Streaming (lbcli)

This article covers the same flow as Log Streaming (REST API), but uses lbcli instead of raw curl commands.

Prerequisites

  • A running Lightbits cluster.
  • lbcli installed and on your $PATH.
  • The system:cluster-admin JWT for the cluster.

Step 1: Setting your JWT and Server

Bash
Copy

All lbcli commands below pass the JWT via -J $JWT and the server via --mgmt-endpoint $SERVER. You can also set LBCLI_MGMT_ENDPOINT in your environment to avoid repeating --mgmt-endpoint on every call.

Step 2: (Optional) Creating a TLS Bundle

A TLS bundle holds the certificate material used for mTLS connections to an Rsyslog target. Skip this step if you only need a Loki target.

Bash
Copy

List the bundles to verify:

Bash
Copy

Step 3: Creating Sources

A source tells Alloy which log stream to collect on each server. You can collect from journald (by syslog identifier) or from a file path.

Control-plane Services (journald)

Bash
Copy

Data-plane Services (journald)

Bash
Copy

Event Log Files (Optional)

Event logs are written to files only when emit_service_events_to_file is enabled in the Ansible config.

Bash
Copy

List all sources to verify:

Bash
Copy

Get a specific source:

Bash
Copy

Step 4: Creating Targets

A target is a log destination. You can have multiple targets; every collected log line is forwarded to all enabled targets.

Loki Target (No TLS)

Bash
Copy

Rsyslog Target (mTLS, Requires TLS Bundle from Step 2)

Bash
Copy

List the targets to verify:

Bash
Copy

Get a specific target:

Bash
Copy

Step 5: Verifying Collector Status

Once the configuration is applied, Alloy polls lightbox-exporter for the rendered pipeline config and begins shipping logs. Check that each server's Alloy agent is healthy:

Bash
Copy

When everything is healthy, each collector entry shows the following:

Copy

If PIPELINE shows DEGRADED or ERROR, check the target connectivity.

Modifying the Configuration

Sources and targets can be updated or deleted without restarting any service. Alloy picks up the new pipeline config on its next remotecfg poll (default: 1 minute).

Only the flags you explicitly pass are changed; unspecified fields keep their current values.

Bash
Copy

Inspecting the Rendered Alloy Pipeline Config

You can inspect the pipeline config that lightbox-exporter renders for Alloy by querying the remotecfg endpoint on the server directly (no auth required — node-local only):

Bash
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard