采集器「华为云-LTS」配置手册¶
阅读本文前,请先阅读:
Tip
使用本采集器前,必须安装「集成 Core 核心包」及其配套的第三方依赖包
1. 配置结构¶
本采集器配置结构如下:
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
region_id |
str | 必须 | 地域 ID 如:'cn-north-1' |
project_id |
str | 必须 | 代表该地域下所需采集的项目 ID |
targets |
list | 非必须 | LTS 采集对象配置列表 |
targets[#].log_group_id |
str | 非必须 | 所需采集的 LTS 日志组 ID |
targets[#].log_streams |
list | 非必须 | 所需采集的 LTS 日志流 ID 列表 |
2. 配置示例¶
获取全部日志组和日志流的日志事件¶
采集全部日志组下的所有日志流
获取全部日志流¶
采集 586e17ad-xxxx
日志组下的所有日志流
collector_configs = [
{
'region_id': 'cn-north-4',
'project_id':'c631xxxx',
'targets': [
{'log_group_id': '586e17ad-xxxx'},
]
}
]
指定指定日志流¶
采集 586e17ad-xxxx
中 ID 为 3253bb3d-xxxx
的日志流
collector_configs = [
{
'region_id': 'cn-north-4',
'project_id':'c631xxxx',
'targets': [
{'log_group_id': '586e17ad-xxxx' ,'log_streams':['3253bb3d-xxxx']},
]
}
]
3. 数据上报格式¶
数据正常同步后,可以在 观测云 的「日志」中查看数据。
以如下采集器配置为例:
collector_configs = [
{
'region_id': 'cn-north-4',
'project_id':'c631xxxx',
'targets': [
{'log_group_id': '586e17ad-xxxx' ,'log_streams':['3253bb3d-xxxx']},
]
}
]
上报的数据示例如下:
{
"measurement": "huaweicloud_lts_586e17ad-xxxx",
"tags": {
"RegionId": "cn-north-4",
"log_group_id": "586e17ad-xxxx",
"log_stream_id": "3253bb3d-xxxx"
},
"fields": {
"content": "{\"severity\":\"NOTE\",\"log_type\":\"error_log\"}",
"labels": "{\"_resource_id\": \"DBS_LOG\", \"_resource_name\": \"DBS_LOG\"}"
}
}
X. 附录¶
华为云 LTS「地域 ID」¶
请参考华为云官方文档: