Documentation

influx write

The influx write command writes data to InfluxDB via stdin or from a specified file. Write data using line protocol, annotated CSV, or extended annotated CSV. If you write CSV data, CSV annotations determine how the data translates into line protocol.

Usage

influx write [flags]
influx write [command]

Subcommands

SubcommandDescription
dryrunWrite to stdout instead of InfluxDB

Flags

FlagDescriptionInput typeMaps to ?
-c--active-configCLI configuration to use for commandstring
-b--bucketBucket namestringINFLUX_BUCKET_NAME
--bucket-idBucket IDstringINFLUX_BUCKET_ID
--configs-pathPath to influx CLI configurations (default ~/.influxdbv2/configs)stringINFLUX_CONFIGS_PATH
--debugOutput errors to stderr
--encodingCharacter encoding of input (default UTF-8)string
--error-filePath to a file used for recording rejected row errorsstring
-f--fileFile to importstring
--formatInput format (lp or csv, default lp)string
--headerPrepend header line to CSV input datastring
-h--helpHelp for the dryrun command
--hostHTTP address of InfluxDB (default http://localhost:9999)stringINFLUX_HOST
--max-line-lengthMaximum number of bytes that can be read for a single line (default 16000000)integer
-o--orgOrganization namestringINFLUX_ORG
--org-idOrganization IDstringINFLUX_ORG_ID
-p--precisionPrecision of the timestamps (default ns)stringINFLUX_PRECISION
--rate-limitThrottle write rate (examples: 5 MB / 5 min or 1MB/s).string
--skipHeaderSkip first n rows of input datainteger
--skipRowOnErrorOutput CSV errors to stderr, but continue processing
--skip-verifySkip TLS certificate verification
-t--tokenAuthentication tokenstringINFLUX_TOKEN
-u--urlURL to import data fromstring

Examples

Line protocol

Write line protocol via stdin
influx write --bucket example-bucket "
m,host=host1 field1=1.2
m,host=host2 field1=2.4
m,host=host1 field2=5i
m,host=host2 field2=3i
"
Write line protocol from a file
influx write \
  --bucket example-bucket \
  --file path/to/line-protocol.txt
Write line protocol from multiple files
influx write \
  --bucket example-bucket \
  --file path/to/line-protocol-1.txt \
  --file path/to/line-protocol-2.txt
Write line protocol from a URL
influx write \
  --bucket example-bucket \
  --url https://example.com/line-protocol.txt
Write line protocol from multiple URLs
influx write \
  --bucket example-bucket \
  --url https://example.com/line-protocol-1.txt \
  --url https://example.com/line-protocol-2.txt
Write line protocol from multiple sources
influx write \
  --bucket example-bucket \
  --file path/to/line-protocol-1.txt \
  --url https://example.com/line-protocol-2.txt

CSV

Write annotated CSV data via stdin
influx write \
  --bucket example-bucket \
  --format csv \
  "#datatype measurement,tag,tag,field,field,ignored,time
m,cpu,host,time_steal,usage_user,nothing,time
cpu,cpu1,host1,0,2.7,a,1482669077000000000
cpu,cpu1,host2,0,2.2,b,1482669087000000000
"
Write annotated CSV data from a file
influx write \
  --bucket example-bucket \
  --file path/to/data.csv
Write annotated CSV data from multiple files
influx write \
  --bucket example-bucket \
  --file path/to/data-1.csv \
  --file path/to/data-2.csv
Write annotated CSV data from a URL
influx write \
  --bucket example-bucket \
  --url https://example.com/data.csv
Write annotated CSV data from multiple URLs
influx write \
  --bucket example-bucket \
  --url https://example.com/data-1.csv \
  --url https://example.com/data-2.csv
Write annotated CSV data from multiple sources
influx write \
  --bucket example-bucket \
  --file path/to/data-1.csv \
  --url https://example.com/data-2.csv
Prepend CSV data with annotation headers
influx write \
  --bucket example-bucket \
  --header "#constant measurement,birds" \
  --header "#datatype dataTime:2006-01-02,long,tag" \
  --file path/to/data.csv

New! Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: