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>
  • Copy
  • Fill window

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)
--timeoutClient timeout in seconds (default is 10)
--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 3

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

Write line protocol to InfluxDB 3 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 1742889600 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1742889600 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1742893200 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1742893200 "
  • Copy
  • Fill window
influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--precision s \ /path/to/metrics.lp
  • Copy
  • Fill window
cat ./metrics.lp | influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--precision s \ -
  • Copy
  • Fill window

Write line protocol to InfluxDB 3 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 1742889600000000000 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1742889600000000000 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1742893200000000000 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1742893200000000000 "
  • Copy
  • Fill window
influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--batch-size 5000 \ /path/to/metrics.lp
  • Copy
  • Fill window
cat ./metrics.lp | influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--batch-size 5000 \ -
  • Copy
  • Fill window

Write line protocol to InfluxDB 3 with a custom client timeout

influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--timeout 20 \ "home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1742889600 home,room=Kitchen temp=21.0,hum=35.9,co=0i 1742889600 home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1742893200 home,room=Kitchen temp=23.0,hum=36.2,co=0i 1742893200 "
  • Copy
  • Fill window
influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--timeout 20 \ /path/to/metrics.lp
  • Copy
  • Fill window
cat ./metrics.lp | influxctl write \
  --token 
DATABASE_TOKEN
\
--database
DATABASE_NAME
\
--timeout 20 \ -
  • Copy
  • Fill window

Write line protocol to InfluxDB 3 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 1742889600000000000
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1742889600000000000
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1742893200000000000
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1742893200000000000
"
  • Copy
  • Fill window

View command updates


Was this page helpful?

Thank you for your feedback!


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.

Read more

InfluxDB 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out: