HTTP Input
Use this input to poll an HTTP or HTTPS endpoint on a fixed interval and store each response.
Documented TOML Example
# Input definition path:
# [inputs.http.<input_name>]
[inputs.http.metrics_api]
# Required: endpoint URL.
# Supported schemes: http, https
url = "https://example.com/api/metrics"
# Required: polling interval in seconds.
# Must be > 0.
repeat_interval = 10
# Required: target entry name in remote bucket.
entry_name = "http/metrics"
# Optional content type override for produced records.
# If omitted, the response Content-Type header is used when available.
content_type = "application/json"
# Optional timestamp mapping. If extraction fails, ingest time is used.
# Use either a JSON field or a response header.
timestamp = { field = "metadata.timestamp", format = "unix_ms" }
# timestamp = { header = "x-event-time", format = "iso8601" }
# Optional bearer token authentication.
bearer_token = "${HTTP_TOKEN}"
# Optional label rules (default = []):
# 1) Dynamic JSON field label:
# { field = "path.to.value", label = "label_name" }
# - path uses dot notation; numeric segments are array indexes.
# 2) Response header label:
# { header = "x-request-id", label = "request_id" }
# - header names are matched case-insensitively.
# 3) Static labels:
# { static = { source = "http", site = "lab" } }
# Merge behavior:
# - rules are applied in order
# - later writes for same key override earlier ones
labels = [
{ field = "device.id", label = "device" },
{ header = "x-request-id", label = "request_id" },
{ static = { source = "http" } }
]
Basic Authentication Example
[inputs.http.status_api]
url = "https://example.com/api/status"
repeat_interval = 30
entry_name = "http/status"
labels = [
{ header = "etag", label = "etag" },
{ static = { source = "status_api" } }
]
[inputs.http.status_api.basic_auth]
username = "bridge"
password = "${HTTP_PASSWORD}"
Runtime Notes
- Each successful poll produces one record.
- Requests use
GET. - Non-JSON responses are stored as raw response bytes.
- JSON field labels are applied only when the response body can be parsed as JSON.
- Failed requests and non-success HTTP statuses skip that polling cycle.
entry_namecannot be empty.repeat_intervalmust be greater than zero.
Performance: Configuring timestamp = { field = "..." } enables payload decoding for each message, which may increase CPU usage. If you already use field-based label rules, no additional cost is incurred since the decoded payload is shared.
Build
Build only HTTP input support:
cargo build --no-default-features --features http
Build all inputs in one command:
cargo build --no-default-features --features all-inputs