文档文档

Amazon Kinesis 输出插件

此插件将指标写入Amazon Kinesis 端点。它会将一个请求中的所有点打包,以减少 API 请求数量。

有关 Kinesis 架构和概念的更多详细信息,请参阅Amazon 官方文档

引入版本: Telegraf v0.2.5 标签: cloud, messaging 操作系统支持: all

Amazon 认证

此插件使用凭证链进行身份验证,以连接到 Kinesis API 端点。插件将按以下顺序尝试进行身份验证。

  1. 通过 STS 的 Web 身份提供商凭证,如果指定了 role_arnweb_identity_token_file
  2. 如果指定了 role_arn 属性,则通过 STS 假定凭证 (源凭证从后续规则评估)
  3. 来自 access_keysecret_keytoken 属性的显式凭证
  4. 来自 profile 属性的共享配置文件
  5. 环境变量
  6. 共享凭证
  7. EC2 实例配置文件

如果您使用的是来自 Web 身份提供商的凭证,则可以使用 role_session_name 指定会话名称。如果留空,将使用当前时间戳。

全局配置选项

插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md

配置

# Configuration for the AWS Kinesis output.
[[outputs.kinesis]]
  ## Amazon REGION of kinesis endpoint.
  region = "ap-southeast-2"

  ## Amazon Credentials
  ## Credentials are loaded in the following order
  ## 1) Web identity provider credentials via STS if role_arn and web_identity_token_file are specified
  ## 2) Assumed credentials via STS if role_arn is specified
  ## 3) explicit credentials from 'access_key' and 'secret_key'
  ## 4) shared profile from 'profile'
  ## 5) environment variables
  ## 6) shared credentials file
  ## 7) EC2 Instance Profile
  #access_key = ""
  #secret_key = ""
  #token = ""
  #role_arn = ""
  #web_identity_token_file = ""
  #role_session_name = ""
  #profile = ""
  #shared_credential_file = ""

  ## Endpoint to make request against, the correct endpoint is automatically
  ## determined and this option should only be set if you wish to override the
  ## default.
  ##   ex: endpoint_url = "https://:8000"
  # endpoint_url = ""

  ## Kinesis StreamName must exist prior to starting telegraf.
  streamname = "StreamName"

  ## Data format to output.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
  data_format = "influx"

  ## debug will show upstream aws messages.
  debug = false

  ## NOTE: Due to the way TOML is parsed, tables must be at the END of the
  ## plugin definition, otherwise additional config options are read as part of
  ## the table

  ## The partition key can be calculated using one of several methods:
  ##
  ## Use a static value for all writes:
  #  [outputs.kinesis.partition]
  #    method = "static"
  #    key = "howdy"
  #
  ## Use a random partition key on each write:
  #  [outputs.kinesis.partition]
  #    method = "random"
  #
  ## Use the measurement name as the partition key:
  #  [outputs.kinesis.partition]
  #    method = "measurement"
  #
  ## Use the value of a tag for all writes, if the tag is not set the empty
  ## default option will be used. When no default, defaults to "telegraf"
  #  [outputs.kinesis.partition]
  #    method = "tag"
  #    key = "host"
  #    default = "mykey"

要使此输出插件正常工作,必须配置以下变量。

  • region
  • streamname

region

region 是您希望连接的 Amazon 区域。示例包括但不限于

  • us-west-1
  • us-west-2
  • us-east-1
  • ap-southeast-1
  • ap-southeast-2

streamname

streamname 用于插件,以确保数据发送到正确的 Kinesis 流。请注意,该流必须为此插件预先配置才能正常工作。如果流不存在,插件将导致 telegraf 以退出代码 1 退出。

partition

这用于在流中对数据进行分组。目前支持四种方法: random、static、tag 或 measurement

random

这将为每个指标生成一个 UUIDv4,以便将它们分散到分片中。使用此方法将丢失任何排序保证

static

这使用静态字符串作为 partitionkey。所有指标都将映射到同一个分片,这可能会限制吞吐量。

tag

这将从每个指标中获取指定标签的值作为 partitionKey。如果找不到标签,将使用 default 值,如果未指定,则使用 telegraf

measurement

这将使用 measurement 的名称作为 partitionKey。

format

format 配置值用于允许用户更改写入 Kinesis 的 Point 的格式。目前支持两种格式:string 和 custom。

string

String 使用默认的 Point.String() 值定义,并翻译为 []byte 以供 Kinesis 流使用。

custom

Custom 是一个字符串,由 FormatMetric() 函数中的多个值定义。


此页面是否有帮助?

感谢您的反馈!


InfluxDB 3.8 新特性

InfluxDB 3.8 和 InfluxDB 3 Explorer 1.6 的主要增强功能。

查看博客文章

InfluxDB 3.8 现已适用于 Core 和 Enterprise 版本,同时发布了 InfluxDB 3 Explorer UI 的 1.6 版本。本次发布着重于操作成熟度,以及如何更轻松地部署、管理和可靠地运行 InfluxDB。

更多信息,请查看

InfluxDB Docker 的 latest 标签将指向 InfluxDB 3 Core

在 **2026 年 2 月 3 日**,InfluxDB Docker 镜像的 latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。

如果使用 Docker 来安装和运行 InfluxDB,latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。例如,如果使用 Docker 运行 InfluxDB v2,请将 latest 版本标签替换为 Docker pull 命令中的特定版本标签 — 例如

docker pull influxdb:2