Sending logs to Loki with Fluent Bit

Fluent Bit can ship logs to self-hosted Loki through either its built-in loki output or Grafana's grafana-loki plugin. This page explains which method to choose, how to map labels and tenants, and how to verify the pipeline.

On this page

Sending logs to Loki with Fluent Bit: which method to use and why

Teams that already run Fluent Bit on hosts or in Kubernetes do not need to replace that agent to get logs into Loki. Loki accepts Fluent Bit as a client, and there are two plugins you can use for it: the integrated loki output maintained by the Fluent Bit project and the grafana-loki plugin published by Grafana Labs. The integration works by keeping your existing tail inputs and filters and adding an output that pushes records to Loki's push API, so the decision is about which output to run, not whether Fluent Bit can feed Loki at all. Fluent Bit is licensed under Apache-2.0 and is a fast, lightweight processor for logs, metrics and traces, written in C with more than 100 built-in plugins, which is why it is often already deployed on servers and nodes where a heavier agent would be unwelcome.

The Fluent Bit project's own loki output is the default choice when you want the agent's maintainers to own the plugin alongside your other Fluent Bit outputs. The grafana-loki plugin is Grafana's own build, so it is the option to weigh if you need behavior or support terms that Grafana documents for its plugin. Before you pick one, check the current configuration keys, label mapping options and tenant header handling for the version you deploy, because these differ between the two plugins and between Fluent Bit releases. Confirm which Fluent Bit release line your hosts and clusters run, and confirm the output options against the Loki Fluent Bit documentation rather than against older examples.

Grafana Alloy is Grafana's supported log shipper for Loki and a vendor-neutral distribution of the OpenTelemetry Collector. If you are not yet committed to Fluent Bit, Alloy is the path Grafana documents most fully for Loki, and it is the right comparison point for any team choosing a new agent. If you are keeping Fluent Bit, plan how it will run alongside your other pipelines, who owns its configuration, and how changes to label mapping will be reviewed and tested before rollout. Loki also has no built-in authentication layer, so whichever shipper you use, the push path into Loki must go through the authenticating reverse proxy and tenant header design you have set for the cluster.

What you need before connecting Fluent Bit to Loki

Most Fluent Bit to Loki problems start before the first log line leaves a node. The cards below cover the agent version, the Loki endpoint and its authentication layer, tenant planning, and the network and certificates on each node that sends logs.

Fluent Bit version line

Pick one Fluent Bit release line and pin it across all nodes. The project published v5.1.0 on August 6, 2026, v5.1.4 on October 16, 2026, and v5.0.11 for the previous line on October 9, 2026. Before you standardize, confirm that the loki output you choose supports the release line you pin, because the integrated plugin and the grafana-loki plugin can differ in configuration keys and supported versions. Test the exact image or package on one node first.

Fluent Bit releases

Authenticating reverse proxy in front of Loki

Loki has no built-in authentication layer, so the write path must sit behind a reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium. Agree with your platform team which proxy will validate client credentials, where those credentials are stored on each node, and how they are rotated. Confirm that the proxy forwards the write path to Loki's push endpoint and passes the tenant header through unchanged.

Loki authentication docs

Tenant plan and X-Scope-OrgID

When auth_enabled is true, Loki identifies each tenant by the X-Scope-OrgID header on every request, and Fluent Bit must set that header in its output configuration. Decide before rollout which tenant IDs map to teams, customers or environments, and who may write to each. Changing tenant IDs later splits history across tenants, so write the mapping down and review it with the teams that will query the data.

Loki multi-tenancy docs

Network routes from each node

Every node running Fluent Bit needs a route to the Loki write endpoint on the port your proxy exposes, and firewall rules must allow that traffic from node subnets or Kubernetes pod networks. Test the route from the same host and network namespace where Fluent Bit runs, not from a workstation, because container and host networks often differ. Ask the network team to confirm egress rules for any segment that crosses a boundary.

TLS certificates on each node

Plan the certificate chain that clients trust before enabling TLS on the proxy. Each node needs the internal certificate authority bundle installed or referenced by the Fluent Bit configuration, and certificate expiry must be on your monitoring list. Mismatched hostnames and missing intermediate certificates are common causes of rejected writes, so validate the chain with a test push before any production node is configured.

Write path access and ownership

Confirm who owns the Loki write path and who can change its routing, limits and authentication. Request a named service account or credential for Fluent Bit rather than a shared administrator secret, and record which team approves changes to the Loki endpoint. Ask your Loki operator to confirm the ingestion limits that apply to your tenants so that a new Fluent Bit deployment does not hit them on the first day.

Choosing the built-in loki output or the grafana-loki plugin

The integrated loki output is maintained by the Fluent Bit project, so its behavior follows Fluent Bit's own release cycle. Fluent Bit is licensed under Apache-2.0, and its releases page lists v5.1.4 published on October 16, 2026. If your team already tracks Fluent Bit upgrades, the output usually arrives through the same change process.

  • Upstream ownership: The Fluent Bit project maintains the output, so fixes reach you through Fluent Bit releases you already review.
  • Where to read: The output is covered in the Fluent Bit manual, and Grafana's Loki Fluent Bit guide shows how it is used with Loki.
  • Release coupling: Your agent version determines which output behavior you get, so pin and test versions together.
  • Support path: Agent issues go to the Fluent Bit project, while Loki server issues go to Grafana Labs, so plan your escalation path before an incident.

Confirm in the Fluent Bit documentation which release introduced each output option you need.

Configuring Fluent Bit to send logs to Loki step by step

This sequence takes a host or Kubernetes node from no log shipping to a verified stream of tailed logs arriving in Loki through a tenant-aware, TLS-protected path, readable in Grafana with a LogQL query.

  1. Install Fluent Bit and confirm the binary

    The platform or operations team installs Fluent Bit on each host or, for Kubernetes, prepares the DaemonSet deployment, using the packaging method your organization already approves. Fluent Bit is licensed under Apache-2.0 and is available for Linux, BSD, macOS and Windows, so confirm the build and version you will standardize on against the fluent/fluent-bit releases page before rollout. Check the install by running the version command on one test node and confirming the service starts and stays up with a minimal configuration. The step is done when the agent runs cleanly on the test node and the version is recorded in your change record.

  2. Define a tail input with a parser

    Write the [INPUT] section using the tail plugin, setting Path to the log files you need, Tag to a stable name, and Parser to a parser that matches the log format, such as a JSON or regex parser defined in a parsers file. Set DB to a position database so restarts do not re-read or lose lines, and set Mem_Buf_Limit to bound memory use. Confirm the chosen parser against real sample lines before deployment, since a mismatched parser sends fields into the wrong place without failing loudly. The step is done when a sample file produces parsed records with the expected fields in a dry run with stdout output.

  3. Add the Kubernetes filter where pods run

    On clusters, add the kubernetes filter so records gain pod, namespace, container and label metadata from the API server. The filter needs read access to pods and namespaces through a service account with a scoped RBAC role, which your cluster team should review before rollout. Decide which Kubernetes labels and annotations become Loki labels in a later step, because the filter enriches records in both cases and high-cardinality values belong in metadata rather than stream labels. The step is done when a test pod's records show the expected namespace, pod and container fields in stdout output.

  4. Configure the Loki output with endpoint, tenant and labels

    Add an [OUTPUT] section for Loki, choosing between the integrated loki plugin maintained by the Fluent Bit project and the grafana-loki plugin, and record the choice and its reason in your design notes. Set the push endpoint, the tenant identifier that Loki reads from the X-Scope-OrgID header when authentication is enabled, and a small, deliberate set of labels such as namespace, host and application. Confirm the exact option names and any tenant or header settings against the Loki Fluent Bit documentation for your Fluent Bit version, because option names differ between plugins. The step is done when config validation passes and the output section contains the endpoint, tenant and label keys you intend to use.

  5. Route traffic through the authenticating reverse proxy with TLS

    Loki has no built-in authentication layer, so point the output at the authenticating reverse proxy in front of Loki, such as nginx, HAProxy, OAuth2 Proxy or Pomerium, and not directly at the Loki port. Enable TLS on that path, configure the client trust chain for the agent, and confirm which credentials the proxy expects, since the network team or security team owns the certificate and secret lifecycle. Send a single test request through the proxy with curl from the node to confirm the TLS handshake, the proxy check and the Loki response. The step is done when the test request is accepted over TLS and the agent output reports successful delivery without retries in its logs.

  6. Run a test log line end to end

    Write a distinctive test line to a tailed file, such as a line containing a unique marker string, and watch the Fluent Bit logs for a successful flush to the Loki output. Check the agent's own metrics or log output for retried or dropped chunks, because silent drops from a wrong tenant header or a rejected label are common failure points. Keep the marker so you can search for it in the next step. The step is done when the agent reports successful delivery for the test line and no retries or errors appear for the output.

  7. Confirm the stream in Grafana with LogQL

    In Grafana, open Explore with the Loki data source that points at the same tenant, and run a stream selector using the labels you set, then filter for the unique marker from the test line. A matching line in the results confirms the full path from tail input to Loki storage and query. Run a second query that counts streams by one of your labels to confirm cardinality is what you expected, and check that the Kubernetes metadata appears where you planned it. The step is done when the marker line returns with the expected labels and the stream count matches your label design.

  8. Roll out to remaining nodes and record the configuration

    Deploy the validated configuration to the remaining hosts or the DaemonSet through your normal configuration management, keeping the tenant, labels and proxy endpoint identical across nodes. Store the configuration, parser files and the output choice in version control and record the Fluent Bit version so upgrades can be tested against it. Repeat the marker check on a sample of nodes in each environment to confirm the rollout matches the test. The step is done when every target node appears in Loki streams and the configuration is recorded under change control.

How Fluent Bit records become Loki streams and labels

Loki does not index the text of log lines. It indexes the labels attached to each record, and every unique combination of label names and values becomes a stream. In a Fluent Bit pipeline, the labels are set in the output configuration, so the decisions you make there determine how many streams Loki creates, how queries select data and how much index Loki must hold. Choose a small, stable set of labels that describe where logs come from, such as host, job and namespace, and let everything else travel inside the log record. Confirm the label keys your chosen output plugin supports (the labels and label_keys settings differ between the integrated loki plugin and the grafana-loki plugin), and test them against a sample log before rolling out the configuration.

Keep high-variation values out of labels. Pod names with generated suffixes, request IDs, trace IDs, user IDs and container IDs create a new stream each time they change, which fragments the index and slows queries. Fluent Bit's Kubernetes filter can attach pod metadata to records, but you should decide deliberately which of those values become labels and which stay in the record body, where a LogQL parser can extract them at query time. Structured fields such as status codes or latency values belong in the JSON body or in a parsed field, not in labels. Ask your Loki team whether structured metadata is enabled in your version, since it offers a middle option for fields you need to filter on without creating streams. Label naming and cardinality limits are covered in the labels and cardinality planning topic in this hub.

Mapping Fluent Bit fields to Loki labels, tenants and content

This table maps each Fluent Bit source field to its Loki destination: a stream label, structured metadata, the tenant header or the log line. Read each row for the cardinality and query cost of the choice, and confirm the exact key names in the plugin documentation for your version before you rely on them.

Source fieldLoki targetCardinality and query costConfirm before use
Tail file path or log file nameStream label (for example a filename or path label)High cost if the path includes rotated suffixes, PIDs or dates, since each value creates a new streamWhether the tail input path is exposed as a label key in your plugin version and how rotation is handled
Container name or container IDStream label for a bounded container name, or structured metadata for the IDContainer IDs change on every restart, so keep them out of labels and use metadata if you need themWhich Kubernetes filter keys carry container name and ID in your release
Kubernetes namespaceStream labelLow to moderate cost, since namespaces are usually bounded and useful for access and queriesThe exact key name produced by the Kubernetes filter and how the loki output maps it
Kubernetes pod nameStructured metadata or dropped fieldPod names are unique per replica and churn during deployments, so labels here inflate stream countsWhether your Loki version accepts structured metadata from the output you choose
Kubernetes labels and annotationsSelected keys as stream labels, the rest droppedCopying every pod label creates many combinations, so map only a short, approved listThe label_keys or equivalent option names in the loki output and whether values are sanitized
Tenant identifierX-Scope-OrgID request header (multi-tenant clusters only)Not a label, but each tenant is isolated, so a wrong value sends logs to the wrong tenantThe tenant_id setting in the output and that auth_enabled is true on the Loki side
Log body or message keyThe log line sent to LokiKeep the body as the line, so filtering with LogQL stays on the content rather than on labelsWhich record key becomes the line and whether JSON records need a line format setting
Log level or severityStream label if bounded (for example info, warn, error), or structured metadataA bounded set of levels is cheap as a label, but free-form values multiply streamsWhether the level field is parsed in your parser and the correct key name in your records

Securing the Fluent Bit to Loki path

Fluent Bit runs on many hosts and holds credentials for Loki, so the path has several places to fail. The cards below cover the transport, the authenticating layer in front of Loki, the identity Fluent Bit uses, the tenant header, the configuration files and the host paths the agent can read.

Encrypt the push path with TLS

Loki has no built-in authentication layer, so traffic from Fluent Bit to Loki should not cross a network in clear text. Terminate TLS at the reverse proxy or load balancer in front of Loki, then point the loki output at the HTTPS address. Check that the certificate chain is trusted by every Fluent Bit host and that the Fluent Bit output is not configured to skip verification.

Loki authentication docs

Authenticate senders at a reverse proxy

Loki's documentation expects an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium to sit in front of it. Every Fluent Bit host must present a credential the proxy checks before a request reaches Loki. Confirm how the proxy rejects unauthenticated pushes and test that a host with no credential is refused.

Give each agent its own least-privilege credential

Issue a separate credential per host or per cluster rather than one shared secret, so a single leak can be revoked without breaking every collector. Limit each credential to the push path it needs and keep read access to queries on separate identities. Ask your identity team how credentials are rotated and whether the proxy can log which credential sent each request.

Set tenant headers at the proxy

When auth_enabled is true, Loki identifies the tenant from the X-Scope-OrgID header on every request. If clients set that header themselves, one team can write into another team's tenant. Have the proxy derive the tenant from the authenticated identity and overwrite or strip any header the client sends, then verify with a test push from a client that sets a different tenant ID.

Loki multi-tenancy docs

Protect the configuration and its secrets

The Fluent Bit configuration file and any environment variables it reads can contain proxy credentials and tenant details. Restrict read access to the service account that runs Fluent Bit, keep credentials out of shared repositories, and prefer files or secret stores injected at start-up. Review who can change the configuration on each host, since a changed output can redirect logs to another destination.

Limit the paths the tail input reads

A tail input runs with the permissions of the Fluent Bit process, so a broad Path pattern can ship files that contain secrets or personal data to Loki. Scope each tail input to the specific log directories it needs, exclude known sensitive files, and run the agent as a user that cannot read files outside those paths. Test the configuration on a non-production host before rollout.

How logs move from Fluent Bit to Loki and Grafana

The path starts at application log files or container stdout, which a Fluent Bit tail input reads and a Kubernetes filter enriches with pod metadata. The loki output then sends records to an authenticating reverse proxy over TLS, since Loki has no built-in authentication. Loki's write path stores chunks and the index in object storage, and Grafana queries Loki through the same proxy. Check the trust boundaries: the node to proxy hop and the proxy to Loki hop are where tokens, tenant headers and certificates must be verified.

Log flow from Fluent Bit through a reverse proxy into Loki, with trust boundaries marked.

Common Fluent Bit to Loki failures and how to fix them

This table lists the failures teams most often hit when Fluent Bit pushes logs to Loki, with the likely cause and the fix for each. Read it by matching the symptom you see in Fluent Bit output or Loki responses to the row, then checking the cause in your own configuration before changing anything. Ingestion errors are easier to diagnose once you monitor the Loki side as well.

FailureLikely causeFix
Pushes rejected with tenant or org errorsauth_enabled is true in Loki but the Fluent Bit output sends no X-Scope-OrgID header, or sends a tenant ID that does not match the one configured in LokiSet the tenant_id on the loki output to the intended tenant, or add the X-Scope-OrgID header through your reverse proxy. Confirm the header reaches Loki with the same value on every request.
Label cardinality errorsPod names, request IDs or other unique values were mapped to labels through label_keys or record_modifier, creating too many streamsKeep labels to low-cardinality values such as namespace, app and container. Move unique identifiers into the log line or structured metadata and check stream counts after the change.
Tail input reads nothingThe Fluent Bit process lacks read permission on the log files, or the Path pattern does not match the files on disk, often after log rotation or a container runtime changeRun Fluent Bit as a user with read access, confirm the glob in Path against the real file list, and check the Fluent Bit log for permission or no-match messages. Also check that the input is not filtered by Exclude_Path.
Duplicate or missing lines after restartThe tail position database (DB) is not configured, is stored on a path that is wiped at restart, or is shared between inputs that track the same filesSet DB to a persistent path on the host or volume, give each tail input its own database file, and test a restart on a sample file to confirm offsets are kept.
TLS handshake or certificate errorsThe Loki endpoint uses a certificate signed by an internal CA that Fluent Bit does not trust, or tls is off while the proxy expects HTTPSProvide the CA file through tls.ca_file, enable TLS on the output, and confirm the host name matches the certificate. Test the endpoint with the same CA before editing Fluent Bit.
Proxy or authentication rejectionsThe authenticating reverse proxy in front of Loki expects basic auth or a bearer token that the output does not send, or a corporate proxy intercepts trafficConfigure http_user and http_passwd or the proxy-required header through the output settings, and keep secrets out of plain files by using environment variables or a secret mount. Check the proxy access log for the rejected request.
Lines dropped by rate limitsLoki per-tenant ingestion limits or stream limits reject bursts, or a noisy container floods a small number of streamsReview the rate and stream limits for the tenant, reduce noisy sources with filters, and set Fluent Bit retry behavior so temporary rejections are retried. Coordinate limit changes with the platform owner.
Ingestion errors not visibleFluent Bit reports success at its own layer while Loki discards entries, so the failure appears only in Loki metrics and logsMonitor ingestion errors on the Loki side as well as Fluent Bit output counters. The Loki monitoring and troubleshooting topic covers the ingestion errors operators see most often.

Questions teams ask before connecting Fluent Bit to Loki

Which Fluent Bit plugin should we use to send logs to Loki?

For most new Fluent Bit to Loki pipelines, start with the integrated loki output maintained by the Fluent Bit project, and check its current documentation before you commit. Fluent Bit also has grafana-loki, a plugin from Grafana. The choice depends on which plugin your Fluent Bit build includes, the labels and tenant header behavior you need, and which project's support path your team prefers. Confirm the supported options for your Fluent Bit version against the Loki Fluent Bit docs and test both on a non-production host before standardizing. Record the decision, because switching plugins later changes how labels are built.

How much effort does a Fluent Bit to Loki integration take?

Effort depends mostly on the number of log sources, how much parsing each source needs, and how many tenants and label rules you must design. A single host with one application log file is a small task. A fleet with mixed formats, Kubernetes metadata enrichment, multiline stack traces and per-team tenant IDs is a multi-step project. Costs come from internal engineer time or a partner's fixed-scope fee, and recurring costs come from maintaining parser configs and upgrading Fluent Bit. Ask any provider for a written scope listing sources, parsers, label mapping, tenancy model and test criteria, then compare quotes against that list rather than against headline numbers.

How long does a first Fluent Bit pipeline to Loki take?

No general duration applies, because the time depends on your environment. A first pipeline for a few well-formed log files on a small set of hosts can move quickly once Loki is reachable. Time grows with the parsing work, the Kubernetes filter setup, network and proxy access, authentication, and the review cycle with your security team. Before planning, confirm the number of sources, which teams own them, whether logs need redaction, and whether a reverse proxy in front of Loki must accept the tenant header. Ask for a milestone plan that separates a pilot source from the full rollout.

Can our own team connect Fluent Bit to Loki without a partner?

Yes, a team with Linux administration, basic Kubernetes skills and access to a running Loki instance can build a first pipeline. The harder parts are predictable: label design that avoids high-cardinality streams, parser testing against real log lines, and getting the proxy and tenant headers right when auth is enabled. Teams usually struggle when they need to cover many formats at once, or when no one owns the configuration after go-live. A partner is most useful for a fixed-scope build with written acceptance tests, handover documentation and a clear owner for upgrades.

What does the platform team need to provide for this work?

The platform team typically provides network paths from log sources to Loki, a tenant or environment model, credentials or secrets management for any write endpoint, and a decision on which labels are allowed. Loki has no built-in authentication layer, so if you expose it beyond a trusted network, an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium must sit in front of it and pass the X-Scope-OrgID header correctly. Ask the team to confirm whether auth_enabled is set, which retention rules apply per tenant, and who can change Fluent Bit configs on hosts and clusters.

How does Fluent Bit compare with Grafana Alloy for sending logs to Loki?

Both can ship logs to Loki, but Grafana Alloy is Grafana's supported log shipper for Loki, and Fluent Bit is a lightweight agent that Loki's documentation also lists as a client. Fluent Bit suits teams that already run it, need a small footprint on constrained hosts, or want to keep one agent across logs, metrics and traces. Alloy suits teams that want Grafana-native pipelines and component-based configuration. Promtail has reached end of life, so teams should not choose it as a base for new work. Compare both on parser needs, Kubernetes metadata handling, your existing agent estate and the support path you require.

What DeployOpen delivers for a Fluent Bit to Loki integration

A DeployOpen engagement for Fluent Bit to Loki is a fixed-scope deliverable set, agreed in writing before work starts. The starting point is an agreed source list: the hosts, container runtimes and Kubernetes clusters whose logs will be collected, the log files and journal streams on each, and the applications whose formats need parsing. From that list we deliver the Fluent Bit configuration: tail or systemd inputs, the parsers that turn raw lines into fields, the Kubernetes filter for pod metadata where clusters are in scope, and the loki output settings for the chosen plugin. Each deliverable is written against the actual sources, so the reader can see which input feeds which stream before anything is turned on.

The second part of the scope covers the decisions that determine whether the Loki cluster stays manageable. We design the label set, keeping low-cardinality values such as cluster, namespace and service as labels and moving high-cardinality fields out of the stream identity, and we map tenants with the X-Scope-OrgID header where multi-tenancy is enabled. We also wire the reverse proxy that carries authentication in front of Loki, along with the TLS settings between Fluent Bit and that proxy, because Loki does not authenticate requests itself. The deliverables close with verification queries that show each source arriving under the expected labels and tenant, and handover notes that record the configuration, the decisions behind it and the steps for adding a new source. Ask any provider to name these items in the written scope, since the depth of parser and label work is what most changes the final price and timeline. Ongoing support, upgrades and continuous testing are available as retainers once the initial scope is complete.

How DeployOpen works on this

DeployOpen plans and builds Fluent Bit log shipping into self-hosted Loki inside your own infrastructure, starting with a written scope that names the sources, the output plugin and the label design. The work ends with documented configuration, verification evidence and a handover your operators can run.

How we scope

  • We inventory the hosts, containers and Kubernetes clusters whose logs must reach Loki, and which of them need Fluent Bit.
  • We agree in writing which Loki output plugin to use, the tenant ID scheme and the label set before configuration starts.
  • Engagements are fixed-scope, so deliverables and timelines are confirmed in writing before any work begins.

How we build

  • We configure tail inputs, parsers and Kubernetes filters on a test source first, then check the resulting labels in Loki.
  • We map fields to labels and structured metadata so stream cardinality stays within the limits you agree on.
  • We test buffering, retries and back-pressure behavior against the Loki endpoint and record the results.

How we hand over

  • You receive the Fluent Bit configuration, parser files and Helm values or service units under version control.
  • You receive a label reference, a runbook for adding a new log source and the verification steps used during the build.
  • We walk your operators through the configuration, the upgrade path for Fluent Bit and the checks to run after a change.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Retainers can cover Fluent Bit version upgrades and changes to parsers or label mappings as your sources change.
  • We can retest log shipping after changes to Loki, its tenancy setup or the authenticating reverse proxy in front of it.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.