Downsampler
The Downsampler plugin automatically rolls raw data into lower resolution summaries, helping InfluxDB users control storage costs, speed queries, and simplify retention. It’s ideal for observability, IoT, infrastructure monitoring, and historical trend analysis, preserving the signal that matters while making telemetry more cost efficient at scale.
Configuration
Plugin parameters may be specified as key-value pairs in the --trigger-arguments flag (CLI) or in the trigger_arguments field (API) when creating a trigger. Some plugins support TOML configuration files, which can be specified using the plugin’s config_file_path parameter.
If a plugin supports multiple trigger specifications, some parameters may depend on the trigger specification that you use.
Plugin metadata
This plugin includes a JSON metadata schema in its docstring that defines supported trigger types and configuration parameters. This metadata enables the InfluxDB 3 Explorer UI to display and configure the plugin.
Required parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
source_measurement |
string | required | Source measurement containing data to downsample |
target_measurement |
string | required | Destination measurement for downsampled data |
window |
string | required (scheduled only) | Time window for each downsampling job. Format: <number><unit> (e.g., “1h”, “1d”) |
Aggregation parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
interval |
string | “10min” | Time interval for downsampling. Format: <number><unit> (e.g., “10min”, “2h”, “1d”) |
calculations |
string | “avg” | Aggregation functions. Single function or dot-separated field:aggregation pairs |
specific_fields |
string | all fields | Dot-separated list of fields to downsample (e.g., “co.temperature”) |
excluded_fields |
string | none | Dot-separated list of fields and tags to exclude from downsampling results |
Filtering parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
tag_values |
string | none | Tag filters. Format: tag:value1@value2@value3 for multiple values |
offset |
string | “0” | Time offset to apply to the window |
Advanced parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
target_database |
string | “default” | Database for storing downsampled data |
max_retries |
integer | 5 | Maximum number of retries for write operations |
batch_size |
string | “30d” | Time interval for batch processing (HTTP mode only) |
TOML configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
config_file_path |
string | none | TOML config file path relative to PLUGIN_DIR (required for TOML configuration) |
To use a TOML configuration file, set the PLUGIN_DIR environment variable and specify the config_file_path in the trigger arguments. This is in addition to the --plugin-dir flag when starting InfluxDB 3.
Example TOML configuration
downsampling_config_scheduler.toml
For more information on using TOML configuration files, see the Using TOML Configuration Files section in the influxdb3_plugins/README.md.
Examples
Example 1: CPU metrics hourly aggregation
Downsample CPU usage data from 1-minute intervals to hourly averages:
# Create the trigger
influxdb3 create trigger \
--database system_metrics \
--path "gh:influxdata/downsampler/downsampler.py" \
--trigger-spec "every:1h" \
--trigger-arguments 'source_measurement=cpu,target_measurement=cpu_hourly,interval=1h,window=6h,calculations=avg,specific_fields=usage_user.usage_system.usage_idle' \
cpu_hourly_downsample
# Write test data
influxdb3 write \
--database system_metrics \
"cpu,host=server1 usage_user=45.2,usage_system=12.1,usage_idle=42.7"
# Query downsampled data (after trigger runs)
influxdb3 query \
--database system_metrics \
"SELECT * FROM cpu_hourly WHERE time >= now() - 1d"
Expected output
| host | usage_user | usage_system | usage_idle | record_count | time_from | time_to | time |
|---|---|---|---|---|---|---|---|
| server1 | 44.8 | 11.9 | 43.3 | 60 | 2024-01-01T00:00:00Z | 2024-01-01T00:59:59Z | 2024-01-01T01:00:00Z |
Aggregation details:
- Before: 60 individual CPU measurements over 1 hour
- After: 1 aggregated measurement with averages and metadata
- Metadata shows original record count and time range
Example 2: Multi-field aggregation with different functions
Apply different aggregation functions to different fields:
# Create trigger with field-specific aggregations
influxdb3 create trigger \
--database sensors \
--path "gh:influxdata/downsampler/downsampler.py" \
--trigger-spec "every:10min" \
--trigger-arguments 'source_measurement=environment,target_measurement=environment_10min,interval=10min,window=30min,calculations=temperature:avg.humidity:avg.pressure:max' \
env_multi_agg
# Write data with various sensor readings
influxdb3 write \
--database sensors \
"environment,location=office temperature=22.5,humidity=45.2,pressure=1013.25"
# Query aggregated data
influxdb3 query \
--database sensors \
"SELECT * FROM environment_10min WHERE time >= now() - 1h"
Example 3: HTTP API downsampling with backfill
Use HTTP API for on-demand downsampling with historical data:
# Send HTTP request for backfill downsampling
curl -X POST http://localhost:8181/api/v3/engine/downsample \
--header "Authorization: Bearer YOUR_TOKEN" \
--data '{
"source_measurement": "metrics",
"target_measurement": "metrics_daily",
"target_database": "analytics",
"interval": "1d",
"batch_size": "7d",
"calculations": [["cpu_usage", "avg"], ["memory_usage", "max"], ["disk_usage", "avg"]],
"backfill_start": "2024-01-01T00:00:00Z",
"backfill_end": "2024-01-31T00:00:00Z",
"max_retries": 3
}'
Ready to get started?
Download InfluxDB 3 and have running in minutes.