How Fluentd sends logs to Loki with fluent-plugin-grafana-loki
A team that already runs Fluentd does not have to replace its collectors to add Loki. The supported route is the fluent-plugin-grafana-loki output plugin, which adds Loki as a destination alongside the outputs the estate already uses. The plugin can be installed on an existing Fluentd host with fluent-gem, or it can be run from the grafana/fluent-plugin-loki Docker image if the collectors are already containerized. Either way, the plugin is the component that formats records and pushes them to Loki's push API, so the choice between gem and image is mostly a question of how your Fluentd hosts are packaged and patched. The Loki documentation for Fluentd is the natural next read for plugin options and version pairing.
Loki also accepts logs from several other shippers, including Fluent Bit, the Docker logging driver, OpenTelemetry over HTTP and Grafana Alloy, which Grafana names as its supported log shipper. That matters for a mixed estate. If some hosts already run Fluentd and others run different agents, Loki can be the common store while each group keeps its own collector. The decision is not whether Fluentd is supported by Loki, but whether keeping Fluentd is the right long-term choice for each host group. Confirm with your platform owners which collectors are staying, which are scheduled for retirement and whether any of them already send to a second backend that would need the same labels.
Before you change any output configuration, record the Fluentd version and packaging in use. Fluentd v1.19.0 was published on July 30, 2025 and v1.19.4 on September 28, 2026, and the fluent-package LTS line is supported until December 2027. Check whether your estate runs td-agent or fluent-package v5, which have reached end of life, since upgrading those hosts may be a prerequisite to any plugin work. Confirm the plugin version you intend to install against the Fluentd release on each host, and confirm that the Loki endpoint, tenant header and authentication path match your deployment, because the plugin's behavior depends on how Loki is configured for authentication and multi-tenancy.
What you need before adding Loki to Fluentd
Adding Loki as a Fluentd destination touches four things at once: the Fluentd release you run, the Loki tenant and endpoint that will receive records, the network path to that endpoint and the authentication layer in front of it. Confirm each one before you edit a single Fluentd configuration file, because a gap in any of them shows up later as silent drops or rejected pushes.
Fluentd version and package channel
Confirm whether you run Fluentd from fluent-package, a self-managed gem install or td-agent. fluent-package LTS v6.0.5 is supported until December 2027, while fluent-package v5 reached end of life in December 2025 and td-agent v4 in December 2023 with no further security updates. If you are on an end-of-life package, plan the upgrade before adding a new output, since the plugin work will otherwise sit on an unpatched base.
fluent-package downloadsSupported operating system targets
Check that your hosts run a platform the fluent-package v6 series is published for, including RHEL 8, 9 and 10, Amazon Linux 2023, Ubuntu 22.04, 24.04 and 26.04, Debian 12 and 13, and 64-bit Windows Server 2016 or later or Windows 10 or later. Hosts outside that list need a gem-based install, which means you own the Ruby runtime, gem dependency updates and plugin compatibility testing yourself.
Loki deployment and tenant plan
Confirm which Loki deployment mode serves your push endpoint and whether auth_enabled is true. When multi-tenancy is on, every request must carry an X-Scope-OrgID header, so decide the tenant ID per team, environment or customer before configuring the plugin. Changing tenant boundaries later means reshaping stored data, so agree the naming scheme and per-tenant limits with the owners of the Loki cluster first.
Network path to the push endpoint
List every Fluentd host or container that will push to Loki and confirm a route, DNS name and firewall rule to the Loki write or gateway address on the port your deployment exposes. Run the path from the same network segment as the Fluentd aggregator, not from a workstation, because egress policies and proxies often differ between the two. Record the exact hostname the TLS certificate covers so the plugin configuration matches it.
Authenticating reverse proxy
Loki has no built-in authentication layer, and its documentation says to run an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Decide how Fluentd will authenticate to that proxy, such as a client certificate, a bearer token or a basic credential, and where that secret will be stored. Confirm that the proxy passes the tenant header through unchanged, since a stripped header routes records to the wrong tenant or none at all.
Loki authentication docsDocker image, if containers are used
If Fluentd runs in containers, decide between the grafana/fluent-plugin-loki image and your own image built with the plugin installed. The prebuilt image saves a build step but fixes the Fluentd and plugin versions it ships, so check those against the LTS line you have chosen. Pin the image tag, and keep the Loki URL and tenant header in environment-specific configuration rather than baked into the image.
Loki Fluentd docsHow log events move from Fluentd to Loki
Log events start at source hosts and enter Fluentd through its inputs, where filters add fields and labels are set for the Loki output. Fluentd buffers events on disk before fluent-plugin-grafana-loki pushes them through an authenticating reverse proxy, which is the only component that should reach Loki directly. Check the trust boundary at the proxy, the X-Scope-OrgID header that selects the tenant, and whether the buffer path survives restarts.
Fluentd forwards labeled, buffered log events to Loki through a reverse proxy.
Configuring the Loki output in Fluentd
This sequence takes an existing Fluentd installation from a plugin-free state to one that ships tagged, labelled and buffered log events to self-hosted Loki and shows them in Grafana. Each step closes with a check, so a failure is caught at the point where it was introduced.
Install Fluentd and the Loki plugin
Your team installs Fluentd or fluent-package on the aggregator or host, then adds the output plugin with fluent-gem install fluent-plugin-grafana-loki. If you run containers, you can use the grafana/fluent-plugin-loki Docker image instead, which bundles the plugin. Pin the plugin and Fluentd versions in your configuration management so later upgrades are deliberate. The step is done when fluentd --version and the plugin listing both return the versions you pinned.
Confirm Loki reachability through the proxy
Loki has no built-in authentication, so the Fluentd host must reach the authenticating reverse proxy in front of Loki, not Loki directly. Your network or platform team confirms the push endpoint, the credentials or client certificates the proxy expects, and whether the proxy forwards the X-Scope-OrgID header. Send a test request from the Fluentd host with curl and check for a successful response before you touch Fluentd configuration.
Add a match block with the loki output
Your team adds a match block to the Fluentd configuration that routes events with the chosen tag to the loki output, setting the endpoint URL and the tenant header that matches your auth_enabled multi-tenancy setup. Keep credentials in files or secrets your platform manages, not in plain text in the repository. The step is done when Fluentd starts with the configuration validated and the output reports no configuration errors in its log.
Define label keys and keep high-cardinality fields out
Choose a small set of stable label keys, such as environment, service and host class, and list them in the output configuration so Loki indexes them as stream labels. Move request IDs, user IDs, IP addresses and similar unbounded values into the log line or structured metadata rather than labels. Ask Loki operators to confirm the label budget for your cluster before rollout. The check is a test event whose labels appear in Grafana's label browser with the expected small set of values.
Configure file buffering and retry
Configure a file buffer with a storage path on a disk with enough space and with write permissions for the Fluentd user, then set retry behavior so events survive a temporary Loki outage. Tune the buffer limits against the volume you expect and the outage you want to ride out, and test the behavior by stopping the proxy briefly. The step is done when buffered chunks accumulate during the outage and drain to Loki after it ends, with no lost events in the test set.
Send test events and check Grafana
Send a known set of test events through the tag, including one with a unique marker string, then query them in Grafana Explore using a LogQL selector that matches your labels. Confirm the tenant that receives the events matches the one your Grafana data source queries. The step is done when every test event appears once, with the expected labels and line content, and no events land in the wrong tenant.
Hand over the configuration and runbook
Your team records the plugin and Fluentd versions, the label set, the buffer path and limits, the tenant mapping and the test procedure in the runbook, and sets alerts on Fluentd buffer growth and output errors. Confirm with your Fluentd support provider, if you have one, that the chosen version is still within its support window. The step is done when an on-call engineer can repeat the test events and find the buffer and error metrics without help from the original builder.
Label and buffering choices that change behavior
Every field the plugin sends to Loki is either a stream label or a piece of metadata attached to individual log lines. Labels define the streams Loki indexes, so each distinct combination of label values creates a separate stream. Detail fields such as user IDs, request IDs, client IP addresses or error messages have many unique values, and putting them in labels multiplies stream count and slows ingestion. Structured metadata keeps those values with each line without expanding the index, which is why it is the usual home for high-cardinality detail. Whether your plugin version and Loki release support the metadata path for the fields you need must be confirmed against the plugin README and the Loki docs for the versions in use.
- Low-cardinality labels: Keep labels such as environment, service, namespace and host, where the set of values stays small and bounded.
- Detail fields as metadata: Move request IDs, trace IDs and user identifiers to structured metadata where your versions support it.
- Record keys to labels in Fluentd: Label mapping is configured in the Fluentd record and output section, so review each key before it reaches Loki.
- Label count limits: Loki enforces per-tenant limits on labels and cardinality, so test a realistic sample before production.
- Dropped fields: Fields you neither label nor keep as metadata may be lost, so decide deliberately which fields you need for investigations.
Check the label and metadata parameter names in the plugin README and the Loki Fluentd docs for your version before you write configuration.
Fluentd holds events in a buffer before sending them to Loki. A memory buffer is fast and needs no disk, but events waiting in memory are lost if the Fluentd process crashes, restarts or the host fails. A file buffer writes chunks to disk, so queued events survive a process restart and can be retried after Loki becomes reachable again. The cost is disk I/O, disk capacity and more operational attention to buffer paths, permissions and free space. Choose based on how much log loss you can accept during a restart and how long a Loki outage you need to absorb.
- Durability: A file buffer keeps queued chunks across restarts, while a memory buffer does not.
- Capacity planning: Size the buffer disk for the backlog you expect during a Loki outage, multiplied by your retry window.
- Retry and overflow behavior: Confirm how the output handles retries and what happens when the buffer fills, since that determines whether new events are rejected or old ones dropped.
- Ownership and permissions: The Fluentd service user must be able to write the buffer path, and the path should survive package upgrades.
- Chunk settings: Flush interval, chunk size and queue length are tuned together; confirm the exact keys for your plugin version.
Confirm the buffer section keys in the plugin README and test a simulated Loki outage on a staging host to see what is retained.
Loki identifies tenants with the X-Scope-OrgID header, and multi-tenancy is active only when auth_enabled is true. A single tenant is simpler to run and suits one team or one environment, but everyone with query access sees all logs. Per-team tenant IDs separate data and limits by team, customer or environment, and let you set per-tenant retention and limits. The trade-off is more configuration in Fluentd, more tenant-specific query and access work in Grafana, and a need to ensure every sender sets the right header. Tenant choice also affects how access control is enforced, because Loki has no built-in authentication layer.
- Tenant header per output: Route each team's stream to the correct tenant by setting the header in the matching output block or by tagging records for routing.
- Access control outside Loki: Loki has no built-in authentication, so an authenticating reverse proxy must map users to permitted tenants.
- Per-tenant limits and retention: Separate tenants let you set different retention and limits, which requires agreeing those values with each owner.
- Misrouting risk: A missing or wrong tenant header can place one team's logs in another team's tenant, so test routing with sample records.
- Enterprise options: Label-based access control and cross-tenant queries are features of Grafana Enterprise Logs, not open-source Loki.
Before choosing, ask your compliance and security owners who must read which logs, then confirm the header and routing settings in the Loki multi-tenancy docs.
Mapping Fluentd record fields to Loki labels and tenants
This table compares each Fluentd source of data, such as the tag, record keys, host and environment fields, with where it should land in Loki: stream labels, structured metadata, the log line or the X-Scope-OrgID tenant header. Read each row for its cardinality risk, since every distinct label combination creates a separate stream. Confirm the exact label and tenant behavior in the fluent-plugin-grafana-loki documentation before you fix the configuration.
| Fluentd source | Suggested Loki destination | Cardinality risk | What to confirm in the plugin docs |
|---|---|---|---|
| Fluentd tag (for example, app.nginx) | Low-cardinality stream label such as job or service | Low when tags are fixed per source; high if tags embed pod or request IDs | How the plugin turns tags or record keys into labels and whether it removes unused keys |
| Host name field | Stream label only if the host set is small and stable | Medium; grows with fleet size and ephemeral instances | Whether the plugin can set labels from record keys and how it handles missing values |
| Environment field (prod, staging, dev) | Stream label, typically a small fixed set | Low; keep the value list closed | Label key naming and whether values are validated before ingestion |
| Team or business unit | Map to a tenant via X-Scope-OrgID when auth_enabled is true | Low per tenant, but each tenant carries its own limits and retention | Whether tenant_id can be taken from a record key or must be a static value per output |
| Request ID, user ID, trace ID | Structured metadata or the log line, not a stream label | High; each unique value creates new streams if used as a label | Whether structured metadata is supported by the plugin version you install and how it is passed |
| Free-text message field | Log line content, left unparsed by default | None as a label; query cost rises with unindexed scans | Which record key becomes the log line and whether the plugin strips it from other fields |
| Nested JSON record keys | Flatten only the keys you query often; drop the rest | Medium; flattening every key multiplies stored metadata | How nested keys are serialized and whether a remove_keys option exists |
Securing the Fluentd to Loki path
Fluentd hosts hold credentials, buffer log data on disk and send it across the network to a store that has no authentication of its own. The cards below cover the controls that connect those points: encryption in transit, a reverse proxy in front of Loki, tenant separation, protected buffers, scoped host accounts and credential handling. Check each one in your environment before the pipeline carries production logs.
TLS between Fluentd and the proxy
Fluentd sends log batches over HTTP to the endpoint you configure in the url setting of the Loki output. Point that URL at the reverse proxy that terminates TLS, not directly at Loki, and confirm the certificate chain is trusted by the Fluentd host. Keep insecure_tls disabled, because a plugin that skips certificate checks lets any host on the path intercept log data. Ask your network team whether traffic crosses zones where encryption is required by policy.
Authentication in front of Loki
Loki has no built-in authentication layer, so the documentation calls for an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Decide how Fluentd authenticates to that proxy, for example with a client certificate or a bearer token, and make sure Loki itself is reachable only through the proxy. Test that a direct request to the Loki port is refused from the network segment where Fluentd runs.
Loki authentication docsTenant isolation with auth_enabled
Loki is multi-tenant only when auth_enabled is true, and each request must carry an X-Scope-OrgID header that names the tenant. Set the tenant per Fluentd source or output so that one team's logs cannot land in another team's tenant. Be aware that the proxy must not let clients choose arbitrary tenant IDs, because a client that can set the header can read or write any tenant. Confirm the mapping with a test query from each tenant.
Protecting buffer directories
Fluentd writes buffer chunks to disk when Loki is slow or unreachable, so those directories hold log data at rest. Give the buffer path an owner limited to the Fluentd service account, restrict its permissions, and place it on a volume that is encrypted if your policy requires encryption at rest. Include buffer paths in your backup and deletion decisions, because a copy left in a buffer can outlive the retention you set in Loki.
Least-privilege Fluentd host accounts
Run the Fluentd or fluent-package service under a dedicated account rather than root, and grant it read access only to the log files it tails and write access to its own buffer and position file paths. Remove interactive login from that account where possible. Review the plugins installed on each host, since every gem or plugin runs with the service account's rights. Ask whether your host baseline already covers these settings.
fluent-package downloadKeeping credentials out of configuration
Proxy tokens, passwords and client key paths should not be typed into the Fluentd configuration file, where they are readable by anyone who can read the config and may be committed to version control. Load them from environment variables or a secrets mechanism managed by your platform, and restrict the file permissions on the config directory. Rotate credentials on a schedule and document who can issue new ones.
Common Fluentd to Loki failures and fixes
This table lists the failures teams most often hit when Fluentd pushes to Loki, with the likely cause and the fix for each. Read it when pushes are rejected, buffers grow, or the plugin disappears after an upgrade, and check the cause column against your own tenancy, label and config setup.
| Failure | Likely cause | Fix |
|---|---|---|
| Pushes rejected with tenant or org errors | auth_enabled is true in Loki but the Fluentd output sends no X-Scope-OrgID header, or sends a tenant ID that does not exist | Set tenant in the loki output to the exact tenant ID, confirm auth_enabled in the Loki config, and test with a single known tenant before rolling out |
| Pushes rejected for label or stream limits | Too many distinct label values, such as request IDs or pod hashes, used as labels, creating high-cardinality streams | Keep only low-cardinality keys in label, move detail into structured metadata or the log line, and review the record_accessor and extra_labels settings |
| Out-of-order or too-old entries rejected | Events arrive with timestamps behind the newest entry in the same stream, often after a buffer replay or a clock skew on the source host | Check host time sync on the Fluentd nodes, keep chunk keys stable per stream, and confirm the Loki ingestion window in your limits |
| Buffer fills and disk usage climbs | Loki is unreachable or slow, so chunks queue in the file buffer until the buffer limit is hit and Fluentd stops accepting or drops data | Confirm network and TLS paths to the push endpoint, size the buffer path and limits for the outage you need to survive, and alert on buffer queue length |
| Plugin not loaded after a Fluentd upgrade | The gem was installed for one Ruby or Fluentd version and is missing from the upgraded package, or the Docker image tag no longer matches the config | Reinstall fluent-plugin-grafana-loki against the new Fluentd version with fluent-gem, then restart and check startup logs for the plugin load line |
| Docker image config not found | The config file or certificate was not mounted into the container at the path the image expects, or the container runs with a different user lacking read access | Mount the fluent.conf and any certificate directories explicitly, confirm the path in the container, and check file permissions for the runtime user |
| Connection errors at startup | Wrong Loki URL, port or scheme, or a proxy or load balancer in front of Loki that does not forward the push path | Test the push endpoint with a simple request from the Fluentd host, verify the URL and TLS settings, and confirm the reverse proxy passes the required headers |
| Logs missing from Grafana queries | Labels set in the config do not match the selector used in the query, or the record_accessor removes the expected key | Compare the labels sent in a test record with the Grafana Explore selector, and confirm the key names in the filter and label settings |
How to test the pipeline and run it after go-live
Start testing before go-live by sending test events that carry known labels, such as a dedicated app value and a unique marker in the message, through the same <match> block that production traffic uses. Query Loki for those markers in Grafana and confirm the labels match what your label configuration intended, with no extra high-cardinality labels and no dropped events. Repeat the test with a deliberately stopped Loki endpoint to confirm the buffer holds data and that the plugin retries rather than discarding it. Record the Fluentd version, the fluent-plugin-grafana-loki version and the Loki version used in the test so that later upgrades can be compared against a known baseline.
After a Loki outage, Fluentd replays buffered chunks once the endpoint accepts writes, so the operational question is whether the buffer can hold the backlog. Confirm the buffer path, the buffer size limits and the overflow behavior in your <buffer> section, and check that the buffer directory sits on storage with enough free space for the outage window you plan for. After any simulated or real outage, verify in Grafana that no time range is missing and that timestamps are not duplicated. Monitor the buffer queue length, the retry count and the age of the oldest chunk through Fluentd's monitor agent, and alert before the buffer approaches its limit. Watch Loki's own ingestion error responses, including rate limit and out-of-order rejections, because a Fluentd retry loop can hide a problem that Loki is actively refusing.
Plan Fluentd upgrades on the LTS channel of fluent-package, since the LTS channel receives only security and bug fixes and fluentd.org recommends it for enterprise services. Confirm the support end date for the release you run with the fluent-package download page before you schedule work, and treat any version past end of life as an open risk. Test each upgrade in a non-production environment with the same plugin version, buffer configuration and test events used at go-live. If your team lacks capacity to handle upgrades or to troubleshoot Fluentd internals, ask vendors that offer commercial Fluentd support, listed on the fluent-package download page, what help they provide for upgrades from end-of-life versions, and include that work in the written scope.
Questions buyers ask about Fluentd and Loki
Do we have to replace our existing Fluentd estate to send logs to Loki?
No. Loki is added as an output destination in the Fluentd configuration, so existing inputs, filters and routing stay in place. The work is adding the fluent-plugin-grafana-loki output, mapping which records become labels, and routing selected streams to Loki while other destinations keep receiving what they receive today. Teams usually test the new output on one pipeline first, then widen it once label design and buffering behave as expected. Confirm the plugin version against your Fluentd version and your fluent-package channel before you change anything in production, and read the Loki Fluentd docs for the current configuration keys.
What drives the cost and effort of adding Loki to Fluentd?
The main drivers are the number of log sources and pipelines, the label design that decides how many streams Loki creates, the tenancy model if several teams or customers share one cluster, the buffer configuration that protects logs during outages, and the work to place an authenticating reverse proxy in front of Loki, since Loki has no built-in authentication layer. Each source with unusual formats adds parsing work, and each tenant adds limits and access rules to plan. Quotes should itemize these areas separately, state which items are one-time setup and which are ongoing operations, and name the owner of each label decision.
How long does it take to send Fluentd logs to Loki?
The duration depends on the scope agreed in writing: how many pipelines are moving, how many log formats need parsing, whether Loki runs on a single server or on object storage in a cluster, and whether tenancy and an authenticating proxy are part of the first release. No duration is set here, so ask for a timeline tied to a named list of pipelines and a test plan. A narrow first release on one pipeline usually reaches production sooner than a full estate cutover, and a quote should show what is included in each phase.
What must our team provide before the work starts?
Your team needs access to the Fluentd hosts or configuration management, a Loki environment with storage and an admin account, and a log inventory listing sources, formats, volumes and the teams that read each stream. You also need a named owner for label decisions, because labels control stream count and query behavior and are hard to change later. Access to the proxy or identity system that will guard Loki, and a sample of representative log records, make the label and parsing work faster and reduce rework.
Can our own engineers do this without a partner?
Yes, provided they have Fluentd and Loki operating experience and time to build a test plan. The official Loki documentation describes the plugin configuration, and the plugin can be installed with fluent-gem or run from the grafana/fluent-plugin-loki Docker image. The points that most often need care are label cardinality, buffer sizing and what happens during a Loki outage, so an internal team should test those explicitly with synthetic load and a failed destination before routing production traffic. A partner is useful when that expertise or review capacity is not available in-house.
Should we use Fluentd or Fluent Bit to send logs to Loki?
Choose Fluentd when you already run it, need its large plugin ecosystem, or require routing and transformation that existing plugins cover. Choose Fluent Bit when you need a smaller footprint on hosts or containers and mainly forward logs. The Fluent Bit documentation compares the two projects, noting that Fluentd is written in C and Ruby, uses more than 60 MB of memory, ships as a Ruby gem with dependencies and has more than 1,000 external plugins. Read the Fluent Bit comparison and our sibling page on sending logs to Loki with Fluent Bit before deciding.
How do we keep Fluentd supported while we add Loki?
Confirm which Fluentd distribution you run. The fluent-package LTS channel receives security and bug fixes only, and the download page says v6.0.5 is supported until December 2027, while fluent-package v5 and td-agent v4 are past end of life. If your estate runs an end-of-life version, plan that upgrade alongside the Loki work, since the plugin and Fluentd versions must match. The download page also lists commercial support providers that can help with upgrades from end-of-life versions.
How DeployOpen scopes and delivers Fluentd to Loki integrations
DeployOpen works on Fluentd to Loki integrations as fixed-scope engagements, agreed in writing before work starts. We scope the existing Fluentd estate, build the fluent-plugin-grafana-loki pipelines inside your infrastructure, and hand over documented configuration your own team can run.
How we scope
- Inventory every Fluentd node, its version and the sources it currently reads from.
- Agree which log sources move to Loki, which labels each stream carries and which stay on existing outputs.
- Record the Loki endpoint, tenant header plan, buffer limits and the written deliverables before any change.
How we build
- Install the plugin with fluent-gem or the grafana/fluent-plugin-loki image, matching your packaging standard.
- Configure label mapping and buffering in a staging environment, then test loss behavior during a simulated Loki outage.
- Run the pipeline in parallel with the current destination before cutting over, and keep a rollback path documented.
How we hand over
- Deliver versioned Fluentd configuration, plugin pins and the image or package build used in your environment.
- Document label choices, buffer settings and the reasons behind them so cardinality decisions stay reviewable.
- Walk your operators through restarts, plugin upgrades and checks that confirm logs arrive in Loki as expected.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- Retainers can cover Fluentd package upgrades, plugin updates and changes to label or buffer configuration.
- Ask in the quote which Fluentd package channel and support terms apply to your estate before scoping starts.

