Documentation

Write line protocol data to InfluxDB Clustered

Learn the fundamentals of constructing and writing line protocol data. Use tools like the influxctl CLI and InfluxDB client libraries to build line protocol and then write it to an InfluxDB database.

You can use these tools to build line protocol from scratch or transform your data to line protocol. However, if you already have CSV data, you might want to use tools that consume CSV and write it to InfluxDB as line protocol.

Line protocol

All data written to InfluxDB is written using line protocol, a text-based format that lets you provide the necessary information to write a data point to InfluxDB.

Line protocol elements

In InfluxDB, a point contains a measurement name, one or more fields, a timestamp, and optional tags that provide metadata about the observation.

Each line of line protocol contains the following elements:

* Required
  • * measurement: A string that identifies the table to store the data in.
  • tag set: Comma-delimited list of key value pairs, each representing a tag. Tag keys and values are unquoted strings. Spaces, commas, and equal characters must be escaped.
  • * field set: Comma-delimited list of key value pairs, each representing a field. Field keys are unquoted strings. Spaces and commas must be escaped. Field values can be strings (quoted), floats, integers, unsigned integers, or booleans.
  • timestamp: Unix timestamp associated with the data. InfluxDB supports up to nanosecond precision. If the precision of the timestamp is not in nanoseconds, you must specify the precision when writing the data to InfluxDB.

Line protocol element parsing

  • measurement: Everything before the first unescaped comma before the first whitespace.
  • tag set: Key-value pairs between the first unescaped comma and the first unescaped whitespace.
  • field set: Key-value pairs between the first and second unescaped whitespaces.
  • timestamp: Integer value after the second unescaped whitespace.
  • Lines are separated by the newline character (\n). Line protocol is whitespace sensitive.

measurement,tag1=val1,tag2=val2 field1="v1",field2=1i 0000000000000000000


For schema design recommendations, see InfluxDB schema design.

Write line protocol to InfluxDB


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 v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered