There is a very similar question here. Anyway, leave your inputs as they are, adding the tag bucket="bucket1"
, bucket="bucket2"
and bucket="bucket3"
. Then you can use
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "xxxxxxx"
organization = "xxxxxx"
bucket = "bucket_for_remaining_data"
bucket_tag = "bucket"
exclude_bucket_tag = false
user_agent = "telegraf_bucket1"
The output plugin will then use the value of the tag bucket
to determine which bucket to use. This only works for influxdb_v2
. Alternatively, you can create three output instances and use metric filtering
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "xxxxxxx"
organization = "xxxxxx"
bucket = "bucket1"
user_agent = "telegraf_bucket1"
[outputs.influxdb_v2.tagpass]
bucket = ["bucket1"]
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "xxxxxxx"
organization = "xxxxxx"
bucket = "bucket2"
user_agent = "telegraf_bucket1"
[outputs.influxdb_v2.tagpass]
bucket = ["bucket2"]
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "xxxxxxx"
organization = "xxxxxx"
bucket = "bucket3"
user_agent = "telegraf_bucket1"
[outputs.influxdb_v2.tagpass]
bucket = ["bucket3"]