Documentation

influxctl write

The influxctl write command writes line protocol to InfluxDB Cloud Dedicated.

Provide line protocol in one of the following ways:

  • a string on the command line
  • a path to a file that contains line protocol
  • as a single dash (-) to read line protocol from stdin

Important to note

  • This command supports only one write request per execution, but does support multiple lines of line protocol and will batch data based on the --batch-size.
  • This command is not meant to be a full, feature-rich write tool. It’s meant for debug, triage, and initial exploration.

InfluxDB connection configuration

Your InfluxDB Cloud Dedicated cluster host and port are configured in your influxctl connection profile. Default uses TLS and port 443. You can set a default database and token to use for the query and write commands in your connection profile or pass them with the command using the --database and --token flags. Command line flags override settings in the connection profile.

Usage

influxctl write [flags] <LINE_PROTOCOL>

Arguments

ArgumentDescription
LINE_PROTOCOLLine protocol to write (command line string, path to file, or - to read from stdin)

Flags

FlagDescription
--batch-sizeNumber of metrics to write per batch (default is 10000)
--databaseDatabase to write to
--precisionPrecision of data timestamps (ns (default), us, ms, or s)
--tokenDatabase token with write permissions on the target database
-h--helpOutput command help

Examples

In the examples below, replace the following:

  • DATABASE_TOKEN: Database token with write access to the target database
  • DATABASE_NAME: Name of the database to write to

Write line protocol to InfluxDB v3

influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
"home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000000000000 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000000000000 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600000000000 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600000000000 "
influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
/path/to/metrics.lp
cat ./metrics.lp | influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
-

Write line protocol to InfluxDB v3 with non-default timestamp precision

influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--precision s \ "home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600 "
influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--precision s \ /path/to/metrics.lp
cat ./metrics.lp | influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--precision s \ -

Write line protocol to InfluxDB v3 with a custom batch size

influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--batch-size 5000 \ "home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000000000000 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000000000000 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600000000000 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600000000000 "
influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--batch-size 5000 \ /path/to/metrics.lp
cat ./metrics.lp | influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--batch-size 5000 \ -

Write line protocol to InfluxDB v3 using credentials from the connection profile

The following example uses the database and token defined in the default connection profile.

influxctl write "home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000000000000
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000000000000
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600000000000
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600000000000
"

Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB Clustered

A highly available InfluxDB 3.0 cluster on your own infrastructure.

InfluxDB Clustered is a highly available InfluxDB 3.0 cluster built for high write and query workloads on your own infrastructure.

InfluxDB Clustered is currently in limited availability and is only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Learn more
Contact InfluxData Sales

The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: