updated influx write command docs, related to #1892

pull/1893/head
Scott Anderson 2020-11-25 12:02:41 -07:00
parent f750e55e8d
commit 3967ec695d
7 changed files with 172 additions and 12 deletions

View File

@ -2,7 +2,7 @@
title: influx write
description: >
The `influx write` command writes data to InfluxDB via stdin or from a specified file.
Write data using line protocol or annotated CSV.
Write data using line protocol, annotated CSV, or extended annotated CSV.
menu:
influxdb_cloud_ref:
name: influx write
@ -11,7 +11,10 @@ weight: 101
influxdb/cloud/tags: [write]
related:
- /influxdb/cloud/write-data/
- /influxdb/cloud/write-data/csv/
- /influxdb/cloud/write-data/developer-tools/csv/
- /influxdb/cloud/reference/syntax/line-protocol/
- /influxdb/cloud/reference/syntax/annotated-csv/
- /influxdb/cloud/reference/syntax/annotated-csv/extended/
---
{{< duplicate-oss >}}

View File

@ -9,6 +9,12 @@ menu:
parent: influx write
weight: 101
influxdb/cloud/tags: [write]
related:
- /influxdb/cloud/write-data/
- /influxdb/cloud/write-data/developer-tools/csv/
- /influxdb/cloud/reference/syntax/line-protocol/
- /influxdb/cloud/reference/syntax/annotated-csv/
- /influxdb/cloud/reference/syntax/annotated-csv/extended/
---
{{< duplicate-oss >}}

View File

@ -11,7 +11,7 @@ menu:
weight: 201
influxdb/cloud/tags: [csv, syntax, write]
related:
- /influxdb/cloud/write-data/csv/
- /influxdb/cloud/write-data/developer-tools/csv/
- /influxdb/cloud/reference/cli/influx/write/
- /influxdb/cloud/reference/syntax/line-protocol/
- /influxdb/cloud/reference/syntax/annotated-csv/

View File

@ -8,8 +8,6 @@ menu:
influxdb_cloud:
name: Write CSV data
parent: Developer tools
aliases:
- /influxdb/cloud/write-data/csv/
weight: 204
related:
- /influxdb/cloud/reference/syntax/line-protocol/

View File

@ -2,7 +2,7 @@
title: influx write
description: >
The `influx write` command writes data to InfluxDB via stdin or from a specified file.
Write data using line protocol or annotated CSV.
Write data using line protocol, annotated CSV, or extended annotated CSV.
menu:
influxdb_2_0_ref:
name: influx write
@ -11,12 +11,23 @@ weight: 101
influxdb/v2.0/tags: [write]
related:
- /influxdb/v2.0/write-data/
- /influxdb/v2.0/write-data/csv/
- /influxdb/v2.0/write-data/developer-tools/csv/
- /influxdb/v2.0/reference/syntax/line-protocol/
- /influxdb/v2.0/reference/syntax/annotated-csv/
- /influxdb/v2.0/reference/syntax/annotated-csv/extended/
---
The `influx write` command writes data to InfluxDB via stdin or from a specified file.
Write data using [line protocol](/influxdb/v2.0/reference/syntax/line-protocol) or
[annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv).
Write data using [line protocol](/influxdb/v2.0/reference/syntax/line-protocol),
[annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv), or
[extended annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv/).
{{% note %}}
When writing CSV data, the `influx write` command uses CSV annotations to
translate the data into line protocol.
For more information about CSV annotations, see [annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv)
and [extended annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv/).
{{% /note %}}
## Usage
```
@ -54,3 +65,138 @@ influx write [command]
| | `--skip-verify` | Skip TLS certificate verification | | |
| `-t` | `--token` | Authentication token | string | `INFLUX_TOKEN` |
| `-u` | `--url` | URL to import data from | string | |
## Examples
- [Write line protocol](#line-protocol)
- [via stdin](#write-line-protocol-via-stdin)
- [from a file](#write-line-protocol-from-a-file)
- [from multiple files](#write-line-protocol-from-multiple-files)
- [from a URL](#write-line-protocol-from-a-url)
- [from multiple URLs](#write-line-protocol-from-multiple-urls)
- [from multiple sources](#write-line-protocol-from-multiple-sources)
- [Write CSV data](#csv)
- [via stdin](#write-annotated-csv-data-via-stdin)
- [from a file](#write-annotated-csv-data-from-a-file)
- [from multiple files](#write-annotated-csv-data-from-multiple-files)
- [from a URL](#write-annotated-csv-data-from-a-url)
- [from multiple URLs](#write-annotated-csv-data-from-multiple-urls)
- [from multiple sources](#write-annotated-csv-data-from-multiple-sources)
- [and prepend annotation headers](#prepend-csv-data-with-annotation-headers)
### Line protocol
##### Write line protocol via stdin
```sh
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
```sh
influx write \
--bucket example-bucket \
--file path/to/line-protocol.txt
```
##### Write line protocol from multiple files
```sh
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
```sh
influx write \
--bucket example-bucket \
--url https://example.com/line-protocol.txt
```
##### Write line protocol from multiple URLs
```sh
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
```sh
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
```sh
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
```sh
influx write \
--bucket example-bucket \
--file path/to/data.csv
```
##### Write annotated CSV data from multiple files
```sh
influx write \
--bucket example-bucket \
--file path/to/data-1.csv \
--file path/to/data-2.csv
```
##### Write annotated CSV data from a URL
```sh
influx write \
--bucket example-bucket \
--url https://example.com/data.csv
```
##### Write annotated CSV data from multiple URLs
```sh
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
```sh
influx write \
--bucket example-bucket \
--file path/to/data-1.csv \
--url https://example.com/data-2.csv
```
##### Prepend CSV data with annotation headers
```sh
influx write \
--bucket example-bucket \
--header "#constant measurement,birds" \
--header "#datatype dataTime:2006-01-02,long,tag" \
--file path/to/data.csv
```

View File

@ -9,13 +9,20 @@ menu:
parent: influx write
weight: 101
influxdb/v2.0/tags: [write]
related:
- /influxdb/v2.0/write-data/
- /influxdb/v2.0/write-data/developer-tools/csv/
- /influxdb/v2.0/reference/syntax/line-protocol/
- /influxdb/v2.0/reference/syntax/annotated-csv/
- /influxdb/v2.0/reference/syntax/annotated-csv/extended/
---
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](/influxdb/v2.0/reference/syntax/line-protocol) and
[annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv).
Supports [line protocol](/influxdb/v2.0/reference/syntax/line-protocol),
[annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv), and
[extended annotated CSV](/influxdb/v2.0/reference/syntax/annotated-csv/extended).
Output is always **line protocol**.
## Usage

View File

@ -11,7 +11,7 @@ menu:
weight: 201
influxdb/v2.0/tags: [csv, syntax, write]
related:
- /influxdb/v2.0/write-data/csv/
- /influxdb/v2.0/write-data/developer-tools/csv/
- /influxdb/v2.0/reference/cli/influx/write/
- /influxdb/v2.0/reference/syntax/line-protocol/
- /influxdb/v2.0/reference/syntax/annotated-csv/