时间戳处理器插件
此插件允许解析包含时间戳的字段为其他格式的时间戳。
引入版本: Telegraf v1.31.0 标签: transformation 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Convert a timestamp field to other timestamp format
[[processors.timestamp]]
## Timestamp key to convert
## Specify the field name that contains the timestamp to convert. The result
## will replace the current field value.
field = ""
## Timestamp Format
## This defines the time layout used to interpret the source timestamp field.
## The time must be `unix`, `unix_ms`, `unix_us`, `unix_ns`, or a time in Go
## "reference time". For more information on Go "reference time". For more
## see: https://golang.ac.cn/pkg/time/#Time.Format
source_timestamp_format = ""
## Timestamp Timezone
## Source timestamp timezone. If not set, assumed to be in UTC.
## Options are as follows:
## 1. UTC -- or unspecified will return timestamp in UTC
## 2. Local -- interpret based on machine localtime
## 3. "America/New_York" -- Unix TZ values like those found in
## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# source_timestamp_timezone = ""
## Target timestamp format
## This defines the destination timestamp format. It also can accept either
## `unix`, `unix_ms`, `unix_us`, `unix_ns`, or a time in Go "reference time".
destination_timestamp_format = ""
## Target Timestamp Timezone
## Source timestamp timezone. If not set, assumed to be in UTC.
## Options are as follows:
## 1. UTC -- or unspecified will return timestamp in UTC
## 2. Local -- interpret based on machine localtime
## 3. "America/New_York" -- Unix TZ values like those found in
## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# destination_timestamp_timezone = ""示例
将时间戳转换为 Unix 时间戳
[[processors.timestamp]]
source_timestamp_field = "timestamp"
source_timestamp_format = "2006-01-02T15:04:05.999999999Z"
destination_timestamp_format = "unix"- metric value=42i,timestamp="2024-03-04T10:10:32.123456Z" 1560540094000000000
+ metric value=42i,timestamp=1709547032 1560540094000000000
将同一时间戳转换为纳秒级 Unix 时间戳
[[processors.timestamp]]
source_timestamp_field = "timestamp"
source_timestamp_format = "2006-01-02T15:04:05.999999999Z"
destination_timestamp_format = "unix_ns"- metric value=42i,timestamp="2024-03-04T10:10:32.123456789Z" 1560540094000000000
+ metric value=42i,timestamp=1709547032123456789 1560540094000000000
将时间戳转换为另一种时间戳格式
[[processors.timestamp]]
source_timestamp_field = "timestamp"
source_timestamp_format = "2006-01-02T15:04:05.999999999Z"
destination_timestamp_format = "2006-01-02T15:04"- metric value=42i,timestamp="2024-03-04T10:10:32.123456Z" 1560540094000000000
+ metric value=42i,timestamp="2024-03-04T10:10" 1560540094000000000
此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。