Storing additional timestamp-type information as a field?


I’m storing some time-series data from find3 in InfluxDB.

One of the fields will be a “first_seen” field, which is a timestamp of when a given device was last-seen.

Example might be:

      "devices": [
          "device": "wifi-fa:d2:44:55:d0:dd",
          "vendor": "?",
          "timestamp": "2018-07-21T22:22:52.833Z",
          "probability": 0.21,
          "randomized": true,
          "num_scanners": 1,
          "active_mins": 1,
          "first_seen": "2018-07-21T22:22:52.833Z"

The plan is to have device, probability, active_mins and first_seen be fields, and vendor, randomized, num_scanners be tags.

According to the line protocol reference, fields can be of type float, integers, strings or booleans. But there’s no timestamp type?

Ideally I’d like to be able to do timestamp operations in InfluxDB on this field (e.g. earlier/later than comparisons etc.).

How do you do this in InfluxDB?

1 Like

You are correct that fields can be floats, integers, strings, or booleans. At present, there is no timestamp type for fields. The docs give some good general recommendations for your InfluxDB schema design.

Could you also give an example of some of the timestamp operations you’d like to perform on InfluxDB using the “first_seen” field?


Example - I’d like to do deltas between first_seen and say, the current time (i.e. now), or the timestamp of that particular point.

1 Like

I would store it as a nanoseconds since epoch integer.