# Fluent Bit

Send the logs Fluent Bit already collects to Flowhawk with one http output.

If Fluent Bit already tails your log files or container logs, add an `http` output in JSON. Flowhawk reads the time, level, message, service and trace id fields by name, and keeps the rest as attributes.

## What you get

- Your logs in [Logs](https://flowhawk.dev/docs/signals#logs), next to your traces and metrics, searchable with the same query language (`severity>=WARN service=checkout "timeout"`), grouped into patterns or followed live.
- A log line that names a request path joins the [business flow](https://flowhawk.dev/docs/flows) of that route, so a failing checkout shows these logs on the checkout flow's page.
- A line that carries a trace id opens its trace.
- Alert on any search with **Alert on this**, and let the agent read these logs when it investigates an incident.

## Set it up

First create an ingest key: in the app, open **Settings > API keys** and pick **Services**. In the examples below, `KEY` stands for that key. Keep it out of your repository, like any other secret.

Add this output to `fluent-bit.conf`. `?service=` names the service when the records don't:

```
[OUTPUT]
    Name   http
    Match  *
    Host   api.flowhawk.dev
    Port   443
    URI    /v1/logs/fluentbit?service=my-app
    Format json
    tls    On
    Header Authorization Bearer ${FLOWHAWK_KEY}
```

Set `FLOWHAWK_KEY` in Fluent Bit's environment. In YAML configuration the same keys go under `pipeline.outputs`. To read JSON log lines into fields, parse them with the `json` parser, or in Kubernetes use the `kubernetes` filter with `Merge_Log On` ([Kubernetes guide](https://flowhawk.dev/integrations/kubernetes-monitoring)).

The same output, with your workspace's address filled in, is in the app under **Settings > Integrations > Log drains**.

## How fields are read

- The log line: `message`, `msg`, `log` or `body`.
- Its severity: `level`, `severity` or `lvl`. Names like `warning` and pino's numbers both work.
- Its time: `timestamp`, `time`, `ts`, `@timestamp` or `date`, as a date string or as seconds, milliseconds or nanoseconds since 1970.
- The service: `service`, `service.name`, `app`, `kubernetes.container_name` or `container_name`, unless `?service=` names it.
- A link to its trace: `trace_id` or `traceparent`.
- The business flow and step: a request path in `path`, `url.path` or `http.route`, with `method`.
- Anything else becomes an attribute you can search and filter on.

## Check it arrived

Open **Logs** in the app and filter on the service. If nothing shows after a minute, [Help and troubleshooting](https://flowhawk.dev/docs/help) says why data can be refused (a wrong key, an empty balance) and how to see it.

## Common questions

### Can Fluent Bit send OpenTelemetry instead?

Yes, its `opentelemetry` output works too, with `Host ingest.flowhawk.dev`, `Port 443`, `Logs_uri /v1/logs`, `tls On` and the same header. The http output above is simpler when records have no `service.name`: it names them from their fields or `?service=`.

### How much can one request carry?

Up to 10,000 records and 5 MB. Fluent Bit's chunks are far smaller. Gzip (`Compress gzip`) is accepted.

## Related

[**Kubernetes monitoring**Pod logs, node and pod metrics and your services' traces from a Kubernetes cluster, with two Helm charts you may already know.](https://flowhawk.dev/integrations/kubernetes-monitoring) [**Vector**Send any log Vector can read to Flowhawk with one http sink.](https://flowhawk.dev/integrations/vector-logs) [**Send logs over HTTP**Post logs as JSON from any script, language or tool that can make an HTTPS request.](https://flowhawk.dev/integrations/http-logs-api)

[Try it free for 14 days](https://app.flowhawk.dev/signup?trial=1) [Read the getting started guide](https://flowhawk.dev/docs/getting-started)

---

URL: https://flowhawk.dev/integrations/fluent-bit
