Fluent Bit
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, 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 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).
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,logorbody. - Its severity:
level,severityorlvl. Names likewarningand pino's numbers both work. - Its time:
timestamp,time,ts,@timestampordate, as a date string or as seconds, milliseconds or nanoseconds since 1970. - The service:
service,service.name,app,kubernetes.container_nameorcontainer_name, unless?service=names it. - A link to its trace:
trace_idortraceparent. - The business flow and step: a request path in
path,url.pathorhttp.route, withmethod. - 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 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.