Skip to content
Latchkey

influx write: Load Line Protocol into InfluxDB in CI

influx write sends line-protocol points to an InfluxDB 2.x bucket using the CLI's configured org and token.

For seeding time-series test data, influx write takes line protocol inline, from a file, or from stdin and writes it to a named bucket.

What it does

influx write accepts InfluxDB line protocol (measurement, tags, fields, optional timestamp) and writes it to a bucket in an org. It targets InfluxDB 2.x/Cloud and authenticates with a token, supplied via a config profile or the --token flag.

Common usage

Terminal
influx write --bucket app --org acme \
  'cpu,host=ci usage=0.42 1700000000000000000'
# from a file of line protocol
influx write --bucket app --org acme --file metrics.lp
# from stdin with second precision
echo 'mem,host=ci used=128' | influx write -b app -o acme -p s

Options

FlagWhat it does
-b, --bucket <name>Destination bucket
-o, --org <name>Organization that owns the bucket
-f, --file <path>Read line protocol from a file
-p, --precision <ns|us|ms|s>Timestamp precision of the input
-t, --token <token>API token (or set via influx config)
--host <url>Server URL, e.g. http://localhost:8086

In CI

Set up a config profile once with influx config (host, org, token) so individual write commands stay short and the token is not repeated. Match --precision to your timestamps; the default is nanoseconds, so a second-precision timestamp written without -p s lands far in the past.

Common errors in CI

"Error: failed to write data: 401 Unauthorized" means a missing or wrong token. "404 Not Found: bucket ... not found" means the bucket or org name is wrong, or setup has not run. "unable to parse ...: invalid field format" means malformed line protocol, often a missing field value or a stray space between tags and fields.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →