Skip to content

Fix Rancher Logging Fluentd – Logs Not Collected

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Fix Rancher Logging Fluentd. We cover key concepts, practical examples, and best practices.

You install Rancher Logging (based on Fluent Bit + Fluentd). Pods are running, but your Elasticsearch cluster shows no logs. Or logs appear for some namespaces but not others.

Wrong ❌

kubectl get pods -n cattle-logging-system
NAME                          READY   STATUS
fluentd-0                     1/1     Running
fluent-bit-xxxxx              1/1     Running

You check Elasticsearch:

```bash
curl elasticsearch:9200/_cat/indices
# β†’ no indices matching "logstash-*" or "fluentd-*"

Output is empty. Fluentd is running but not forwarding anything.

You check Fluentd logs:

No outputs configured. Fluentd ignores all events.

## Right βœ…

**Check the Logging configuration:**

1. **Rancher β†’ Cluster β†’ Tools β†’ Logging**
2. **Cluster Outputs** β†’ should have at least one output defined (e.g. Elasticsearch, Splunk, S3)
3. **Cluster Flows** β†’ should have a flow that matches namespaces and routes to the output

**Deploy an Elasticsearch output:**

```yaml
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
  name: elasticsearch-output
  namespace: cattle-logging-system
spec:
  elasticsearch:
    host: elasticsearch.example.com
    port: 9200
    scheme: https
    ssl_verify: false
    user: elastic
    password:
      valueFrom:
        secretKeyRef:
          name: elasticsearch-credentials
          key: password
    buffer:
      chunk_limit_size: 2MB
      queue_limit_length: 8

**Deploy a ClusterFlow to capture all logs:**

```yaml
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
  name: all-logs
  namespace: cattle-logging-system
spec:
  match:
    - select: {}
  globalOutputRefs:
    - elasticsearch-output

**If some namespaces are missing logs β€” check the Flow selector:**

```yaml
spec:
  match:
    - select:
        labels:
          app: my-app       ← only matches namespaces with this label

Change to `select: {}` to match all namespaces, or add specific namespace `match`:

```yaml
spec:
  match:
    - namespaces:
        - default
        - production
        - staging

**Verify logs are flowing:**

```bash
kubectl exec -n cattle-logging-system fluentd-0 -- fluentd --show-config
# β†’ should show elasticsearch output plugin configured

βœ… Elasticsearch indices: fluentd-2024.06.24 (42 GB, 120k docs)

## Root Cause

Rancher Logging installs the infrastructure (Fluent Bit + Fluentd) but it does **not** create any outputs or flows. Without an `Output` and `ClusterFlow` (or `Flow`) resource, Fluentd has no target to ship logs to, and logs are dropped.

## Prevention

- Configure **ClusterOutput** and **ClusterFlow** immediately after installing the Logging app.
- Use **ClusterFlow** (not `Flow`) to capture all namespaces β€” `Flow` is namespace‑scoped.
- Set buffer parameters (`chunk_limit_size`, `queue_limit_length`) for production resilience.
- Test with `kubectl logs` on Fluentd pods to verify the output plugin connects.


## Common Mistakes with logging fluentd

1. **Using `foldl` instead of `foldl'` causing stack overflow on large lists**
2. **Forgetting `deriving (Show, Eq)` on custom data types needed for debugging**
3. **Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable**

These mistakes appear frequently in real-world RANCHER code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

## Practice Exercise

**Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.**

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

## FAQ

<details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Can I send logs to multiple outputs?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes β€” add multiple <code>globalOutputRefs</code> in the ClusterFlow. Each output receives a copy of the log stream.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Why is Fluentd restarting in a crash loop?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Check the config syntax: <code>kubectl exec -n cattle-logging-system fluentd-0 -- fluentd --dry-run -c /fluentd/etc/fluent.conf</code>.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Can I filter logs by container name?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes β€” use <code>match</code> in the Flow: <code>- select: { labels: { app: nginx } }</code>.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Does Rancher Logging support `systemd` journal?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes β€” Fluent Bit has a <code>systemd</code> input plugin that collects kernel and system service logs.</p>
</div></details>

---

*Logging configuration is covered in the [DodaTech Rancher Logging course](https://dodatech.com/courses/rancher).*

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro