Line protocol

Lines separated by the newline character represent a single point in InfluxDB. Line protocol is whitespace sensitive.

Line protocol does not support the newline character \n in tag or field values.

  1. measurementName,tagKey=tagValue fieldKey="fieldValue" 1465839830100400200
  2. --------------- --------------- --------------------- -------------------
  3. | | | |
  4. Measurement Tag set Field set Timestamp

(Required) The measurement name. InfluxDB accepts one measurement per point. Measurement names are case-sensitive and subject to .

*Data type: String*

Tag set

Optional – All tag key-value pairs for the point. Key-value relationships are denoted with the = operand. Multiple tag key-value pairs are comma-delimited. Tag keys and tag values are case-sensitive. Tag keys are subject to naming restrictions.

*Key data type:
**
Value data type:* String

Field set

(Required) All field key-value pairs for the point. Points must have at least one field. Field keys and string values are case-sensitive. Field keys are subject to naming restrictions.

*Key data type:
**
Value data type:* Float | | UInteger | | Boolean

  1. measurementName fieldKey="field string value" 1556813561098000000

Timestamp

Optional – The unix timestamp for the data point. InfluxDB accepts one timestamp per point. If no timestamp is provided, InfluxDB uses the system time (UTC) of its host machine.

*Data type: *

Important notes about timestamps

  • To ensure a data point includes the time a metric is observed (not received by InfluxDB), include the timestamp.
  • If your timestamps are not in nanoseconds, specify the precision of your timestamps when .

Whitespace in line protocol determines how InfluxDB interprets the data point. The first unescaped space delimits the measurement and the tag set from the field set. The second unescaped space delimits the field set from the timestamp.

  1. measurementName,tagKey=tagValue fieldKey="fieldValue" 1465839830100400200
  2. 1st space 2nd space

Data types and format

Float

IEEE-754 64-bit floating-point numbers. Default numerical type. InfluxDB supports scientific notation in float field values.

Float field value examples

Integer

Signed 64-bit integers. Trailing i on the number specifies an integer.

Integer field value examples
  1. myMeasurement fieldKey=1i
  2. myMeasurement fieldKey=12485903i
  3. myMeasurement fieldKey=-12485903i

UInteger

Unsigned 64-bit integers. Trailing u on the number specifies an unsigned integer.

Minimum uintegerMaximum uinteger
0u18446744073709551615u
UInteger field value examples
  1. myMeasurement fieldKey=1u
  2. myMeasurement fieldKey=12485903u

Plain text string. Length limit 64KB.

String example
  1. # String measurement name, field key, and field value

Boolean

Stores true or false values.

Boolean field value examples

Unix timestamp

Unix timestamp in a . Default precision is nanoseconds (ns).

Minimum timestampMaximum timestamp
-92233720368547758069223372036854775806
Unix timestamp example
  1. myMeasurementName fieldKey="fieldValue" 1556813561098000000

Line protocol supports single and double quotes as described in the following table:

* Line protocol accepts double and single quotes in measurement names, tag keys, tag values, and field keys, but interprets them as part of the name, key, or value.

Special Characters

Line protocol supports special characters in string elements. In the following contexts, it requires escaping certain characters with a backslash (\):

ElementEscape characters
MeasurementComma, Space
Tag keyComma, Equals Sign, Space
Tag valueComma, Equals Sign, Space
Field keyComma, Equals Sign, Space
Field valueDouble quote, Backslash

You do not need to escape other special characters.

Examples of special characters in line protocol
  1. # Measurement name with spaces
  2. my\ Measurement fieldKey="string value"
  3. # Double quotes in a string field value
  4. myMeasurement fieldKey="\"string\" within a string"
  5. # Tag keys and values with spaces
  6. myMeasurement,tag\ Key1=tag\ Value1,tag\ Key2=tag\ Value2 fieldKey=100
  7. # Emojis
  8. myMeasurement,tagKey=🍭 fieldKey="Launch 🚀" 1556813561098000000

Escaping backslashes

Line protocol supports both literal backslashes and backslashes as an escape character. With two contiguous backslashes, the first is interpreted as an escape character. For example:

Line protocol interprets # at the beginning of a line as a comment character and ignores all subsequent characters until the next newline \n.

  1. # This is a comment

Naming restrictions

Measurement names, tag keys, and field keys cannot begin with an underscore _. The namespace is reserved for InfluxDB system use.