influx write dryrun

  • influx CLI 2.0.0+
  • InfluxDB 2.0.0+

The influx write dryrun command prints write output to stdout instead of writing to InfluxDB. Use this command to test writing data.

Supports line protocol, annotated CSV, and extended annotated CSV. Output is always line protocol.

Usage

  1. influx write dryrun [flags]

Flags

FlagDescriptionInput typeMaps to ?
-c—active-configCLI configuration to use for commandstring
-b—bucketBucket name (mutually exclusive with —bucket-id)stringINFLUX_BUCKET_NAME
—bucket-idBucket ID (mutually exclusive with —bucket)stringINFLUX_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
—errors-filePath to a file used for recording rejected row errorsstring
-f—fileFile to importstringArray
—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 name (mutually exclusive with —org-id)stringINFLUX_ORG
—org-idOrganization ID (mutually exclusive with —org)stringINFLUX_ORG_ID
-p—precisionPrecision of the timestamps (default ns)stringINFLUX_PRECISION
—rate-limitThrottle write rate (examples: 5MB/5min or 1MB/s).string
—skip-verifySkip TLS certificate verificationINFLUX_SKIP_VERIFY
—skipHeaderSkip first n rows of input datainteger
—skipRowOnErrorOutput CSV errors to stderr, but continue processing
-t—tokenAPI tokenstringINFLUX_TOKEN
-u—urlURL to import data fromstringArray

Examples

Authentication credentials

The examples below assume your InfluxDB host, organization, and token are provided by either the active influx CLI configuration or by environment variables (INFLUX_HOST, INFLUX_ORG, and INFLUX_TOKEN). If you do not have a CLI configuration set up or the environment variables set, include these required credentials for each command with the following flags:

Line protocol

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

CSV

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

write