Send logs over HTTP

Post logs as JSON from any script, language or tool that can make an HTTPS request.

When nothing else fits (a shell script, a batch job, a device, a tool with webhooks), post logs straight to Flowhawk. One endpoint takes a JSON object, a JSON array or newline-delimited JSON.

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.

Send a log

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.

curl -X POST "https://api.flowhawk.dev/v1/logs/json?service=billing-job" \
  -H "Authorization: Bearer KEY" \
  -d '{"message":"payment declined","level":"error","path":"/api/checkout","trace_id":"4bf92f3577b34da6a3ce929d0e0e4736"}'

Several at once, as an array or one object per line:

[{"message":"run started","level":"info"},{"message":"3 rows skipped","level":"warn","rows":3}]

From Python

import os, requests
requests.post(
    "https://api.flowhawk.dev/v1/logs/json?service=billing-job",
    json=[{"message": "run finished", "level": "info", "rows": 1204}],
    headers={"Authorization": f"Bearer {os.environ['FLOWHAWK_KEY']}"},
    timeout=10,
).raise_for_status()

From Node.js

await fetch("https://api.flowhawk.dev/v1/logs/json?service=billing-job", {
  method: "POST",
  headers: { "content-type": "application/json", authorization: `Bearer ${process.env.FLOWHAWK_KEY}` },
  body: JSON.stringify([{ message: "run finished", level: "info", rows: 1204 }]),
});

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.

Limits

  • Up to 10,000 records and 5 MB per request. A gzipped body is accepted.
  • The key goes in the Authorization header. Flowhawk does not accept a key in the address, because addresses end up in logs.

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

Should I use this from my app?

For a service, an OpenTelemetry SDK or a Flowhawk SDK is better: it sends logs with their trace and flow, batches and retries for you (language guides). This endpoint is for everything else.

Can I tell Flowhawk a job ran?

For "did the nightly job run", use a heartbeat check instead: it pages you when the ping doesn't come.