Time-Series

Columnar time-series storage with InfluxDB line protocol, structured queries, FloQL pipelines and one-off retention trims.

Flo includes a built-in time-series engine for metrics, telemetry, and IoT data. It supports single-point writes, batch ingestion via InfluxDB line protocol, structured aggregation queries, and FloQL — a pipeline query language for advanced analytics. All writes are Raft-replicated.

Core Concepts

Each data point consists of four components:

  • Measurement — The metric name (e.g., cpu, memory, http_requests)
  • Tags — Indexed key-value pairs for filtering (e.g., host=web-01,region=us-east)
  • Fields — The actual metric values. A single value uses the default field name value; multi-field writes name each field explicitly (e.g., user=72.5,system=7.4)
  • Timestamp — Kept in nanoseconds. --timestamp takes milliseconds, and a batch takes the unit --precision names, kept exactly. When omitted, a single --value write takes the server's time; --fields and batch lines without one take the CLI's time, once for all their fields.

A series is the unique combination of measurement + tag set + field name. A series keeps every point written to it until a delete or a retention trim removes it.

Tag sets are order-independent: host=a,env=b and env=b,host=a are the same series. Tags are stored alongside the series, so they survive a restart and can be matched on at query time rather than only compared for exact equality.

Writing Data

Single Point

# Write a single value (field name defaults to "value")
flo ts write cpu --tags host=web-01,region=us-east --value 82.5
 
# Write with an explicit timestamp (milliseconds since epoch)
flo ts write cpu --tags host=web-01 --value 72.5 --timestamp 1708700400000
 
# Write with no tags
flo ts write global_metric --value 99.9

Multi-Field

Write multiple named fields in a single data point:

flo ts write cpu --tags host=web-01 --fields "user=72.5,system=7.4,idle=20.1"

Each field creates a separate series under the same measurement and tag set, and all of them get one timestamp. Query individual fields with --field. Each field is its own write, so if one is refused the fields before it are already stored.

Batch Write (InfluxDB Line Protocol)

Ingest many points at once using InfluxDB line protocol format:

measurement,tag1=val1,tag2=val2 field1=value1,field2=value2 [timestamp]
# From a file
flo ts write --batch --file /path/to/data.txt --precision ms
 
# From stdin
cat data.txt | flo ts write --batch --precision ns

The --precision flag specifies the timestamp unit in the payload. Every unit is kept exactly, to the nanosecond:

PrecisionDescription
nsNanoseconds (InfluxDB default)
usMicroseconds
msMilliseconds (Flo default)
sSeconds

A timestamp must be after 1970 and no later than 2262-04-11T23:47:16Z, the latest a signed 64-bit count of nanoseconds holds; one outside that is refused.

Field types: float values are stored natively, integers (suffix i) are converted to f64, booleans become 0.0/1.0. String fields are not supported.

The CLI parses the lines itself and sends one write per field. A line that fails to parse or is refused is reported with its line number and the token at fault, and none of its fields are written. The other lines are still written, and the command exits non-zero. Backslash escapes aren't supported; a line using them is refused.

Values must be finite numbers: nan and inf are refused.

Reading Data

Raw Reads

Retrieve individual data points within a time range:

# Read last hour of CPU data for host web-01
flo ts read cpu --tags host=web-01 --from -1h
 
# Read a specific time range
flo ts read cpu --tags host=web-01 --from 1708700000000 --to 1708700500000
 
# Read a specific field
flo ts read cpu --tags host=web-01 --field system --from -1h
 
# The newest 100 points, newest first
flo ts read cpu --tags host=web-01 --newest --limit 100
 
# Every point in a day, page after page
flo ts read cpu --tags host=web-01 --from -24h --all -o raw
 
# Output as JSON
flo ts read cpu --tags host=web-01 --from -1h -o json

The --from and --to flags accept relative durations (-1h, -30m, -7d) or absolute epoch-millisecond timestamps.

A read returns a page of the matching points: oldest first from --from (an hour ago by default), or newest first with --newest, which reaches back as far as it pages unless you give a --from. A page holds up to --limit points, 4,096 at most and by default. When more follow, the read says where to go on:

Note: more points follow: --cursor 0017a3c94f2e80000000000000012c00

Pass that cursor to read the next page, or --all to follow the pages to the last (with -o raw or -o json, which print each page as it comes). Pages go on from the last point read, so a point that was there for the whole read is read once: none repeated, none skipped, even among points that share a time. With -o json, the read prints {"points": [...], "cursor": ...}, each point with its time_ns (its exact time, in nanoseconds) beside timestamp_ms, and cursor the next page's, or null on the last. Times are kept to the nanosecond: a point stamped by the server when it took the write, rather than given a timestamp, keeps its nanoseconds, and a read answers them.

A read of a series that doesn't exist, where the measurement has no series of the field with the given tags, is not found (exit 1). A series that exists, with no points in the range or past the cursor, answers no points and succeeds. A series goes with its last point: once retention ages out every point of a series, or a delete removes it, the series no longer exists and a read of it is not found (unlike a stream, which stays when it is trimmed empty).

To summarise more points than a page holds, use flo ts query, which aggregates every point in its range, up to 1,048,576 points per query. Past that, narrow the range or the tags.

Filtering by Tag

A tag filter constrains only the tags it names, so a partial filter matches any series whose tag set contains it:

# Written with two tags
flo ts write cpu --tags host=web-01,env=prod --value 72.5
 
# All three of these match it
flo ts read cpu --tags host=web-01 --from -1h            # partial
flo ts read cpu --tags env=prod --from -1h               # partial, other tag
flo ts read cpu --tags env=prod,host=web-01 --from -1h   # full set, any order

Omitting --tags reads across every tag-series for the measurement and field, merged in timestamp order.

The CLI's --tags is equality-only. For negation and wildcards, use FloQL source filters:

OperatorMeaningExample
=Equals{host=web-01}
!=Not equals — also matches series lacking the tag{env!=staging}
=~Glob match (*, ?){host=~web-*}
!~Glob non-match{path!~*-west}

Structured Queries

Aggregate data over time windows using built-in functions:

# Average CPU usage over 5-minute windows in the last hour
flo ts query cpu --tags host=web-01 --from -1h --window 5m --agg avg
 
# Sum of HTTP requests over 1-minute windows
flo ts query http_requests --tags method=GET --from -1h --window 1m --agg sum
 
# Count points per 10-minute window
flo ts query cpu --tags host=web-01 --from -6h --window 10m --agg count
 
# Min and max
flo ts query temperature --tags sensor=A1 --from -24h --window 1h --agg min
flo ts query temperature --tags sensor=A1 --from -24h --window 1h --agg max
FlagDefaultDescription
--aggavgAggregation function: avg, sum, count, min, max
--window1mWindow size: Ns, Nm, Nh, Nd
--from-1hStart time (relative or epoch ms)
--tonowEnd time

Windows are aligned to the epoch (timestamp / window * window), so a bucket's start does not shift with --from and the same point always lands in the same bucket across queries. Each row of the result is one window. With -o json, each bucket has start_ms and start_ns.

Output Formats

All read and query commands support three output formats via --format:

  • table (default) — Formatted columns with headers
  • json — JSON array with timestamp_ms and value fields
  • raw — Space-separated timestamp value per line, suitable for piping

FloQL

FloQL is Flo's pipeline query language for time-series analytics. It combines source selection, filtering, windowing, aggregation, and transformation in a single expression:

# Average CPU usage over 5-minute windows in the last hour
flo ts floql "cpu{host=web-01}[1h] | window(5m) | avg()"
 
# Rate of change per minute
flo ts floql "http_requests{method=GET}[1h] | rate(1m)"
 
# Filter, window, aggregate, and transform
flo ts floql "cpu{region=us-east}[6h] | window(15m) | max() | where(value > 90)"
 
# Group by tag, then aggregate
flo ts floql "cpu[1h] | group_by(host) | window(5m) | avg()"
 
# Arithmetic transformation
flo ts floql "temperature{unit=celsius}[24h] | math(value * 1.8 + 32) | alias(fahrenheit)"

Source Syntax

measurement{tag_filters}[time_range]
  • Measurement — Metric name (required)
  • Tag filters — Optional. Comma-separated key=value pairs inside {}
  • Time range — Required. Duration ([1h]), absolute range ([1708700000000..1708800000000]), or omit brackets for default 1h

Tag Filter Operators

OperatorDescriptionExample
=Equals{host=web-01}
!=Not equals{env!=staging}
=~Regex match{host=~web-.*}
!~Regex not match{path!~health}

Multiple filters are comma-separated: {host=web-01,region=us-east}

Time Range Formats

FormatExampleDescription
Duration[1h]Last N units from now
Duration units[30s], [5m], [1h], [7d]Seconds, minutes, hours, days
Relative range[2h..1h]From two hours ago to one hour ago
Absolute[1708700000000..1708800000000]Epoch millisecond range
From a time[1708700000000]From that epoch millisecond on, with no end

A bare number in a range is always epoch milliseconds, as --from and --to take. One past the year 3000 as milliseconds is refused, since it's most likely a nanosecond or microsecond time pasted in. A range whose start is after its end is refused rather than read as empty. FloQL answers each point's time in nanoseconds; the CLI prints it in milliseconds.

Pipeline Stages

Stages are chained with | and executed left to right. Each stage transforms a set of series:

StageSyntaxDescription
windowwindow(5m)Bucket points into time windows
avgavg()Mean value per window
sumsum()Sum per window
countcount()Count per window
minmin()Minimum per window
maxmax()Maximum per window
firstfirst()First value per window
lastlast()Last value per window
percentilepercentile(99)Nth percentile (0–100)
raterate(1m)Per-second rate of change
deltadelta()Difference between consecutive points
wherewhere(value > 90)Filter points by value
group_bygroup_by(host)Split series by tag value
topktopk(5)Keep top K series by value
bottomkbottomk(5)Keep bottom K series by value
mathmath(value * 100)Arithmetic: +, -, *, /, %
fieldfield(system)Select a specific field name
aliasalias(cpu_avg)Rename the output series
absabs()Absolute value
ceilceil()Ceiling
floorfloor()Floor
roundround(2)Round to N decimal places

A typical query chains window() → aggregation → optional post-processing:

cpu{host=web-01}[1h] | window(5m) | avg() | where(value > 80) | round(2)

A FloQL query reads at most 131,072 points to run its stages over, and answers at most 4,096 raw points. Past either, it's refused: narrow the range or the tags, aggregate, or page through the raw points with flo ts read.

Managing Data

List Measurements

# List all measurements
flo ts list
flo ts ls
 
# Limit results
flo ts list --limit 50
 
# JSON output
flo ts list -o json

Delete

# Delete an entire measurement (requires --confirm)
flo ts delete cpu --confirm
 
# Delete a specific series by tag
flo ts delete cpu --tags host=web-01 --confirm

Without --confirm, the delete command fails with an error — this prevents accidental data loss.

Retention

flo ts retention deletes a measurement's points older than a duration, in the namespace you name, once:

# Delete cpu's points older than 7 days
flo ts retention cpu --raw-ttl 7d

It is not a standing policy: points that age past the duration later stay until it is run again. Other measurements, and cpu in other namespaces, are untouched. Downsampling isn't supported (tracked in #158).

Points are kept until a delete or a retention trim removes them: there is no default retention, and every point takes memory on the shard that holds its series. Running flo ts retention is how you bound that today. The metrics flo_shard_ts_points and flo_shard_ts_point_bytes show how many points each shard holds and the bytes they take.

Namespace Isolation

Time-series data is isolated by namespace. The same measurement name in different namespaces contains independent data:

flo ts write cpu --tags host=web-01 --value 82.5 -n production
flo ts write cpu --tags host=web-01 --value 45.0 -n staging
 
# Each namespace has its own data
flo ts read cpu --tags host=web-01 --from -1h -n production
flo ts read cpu --tags host=web-01 --from -1h -n staging

Durability

  • All writes are Raft-replicated before the response is sent
  • Each point is part of its shard's replicated state, applied from the committed log entry that wrote it, so every replica holds the same points
  • On restart, the shard rebuilds them from its log; no separate WAL for time-series data

How It Works

  • Points — Each point is a record keyed by its series, then its time, then the log index of the write that made it, so a series' points sit in time order and no two share a key, even at the same time.
  • Series — Each series is a record of its tags, point count and oldest and newest times. Listing measurements and ts info read these, not the points.
  • Reads — A read seeks to the start of each matching series and merges them in time order, so reading one series costs only that series' points. Aggregations (avg, sum, min, max, count) take every point in the range.

See Storage Internals for details.