采集器「腾讯云-PostgreSQL 慢查询详情日志」配置手册¶
阅读本文前,请先阅读:
Tip
使用本采集器前,必须安装「集成 Core 核心包」及其配套的第三方依赖包
Tip
本脚本的代码运行依赖 PostgreSQL 实例对象采集,如果未配置 PostgreSQL 的自定义对象采集,慢日志脚本无法采集到慢日志数据
1. 配置结构¶
本采集器配置结构如下:
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
regions |
list | 必须 | 所需采集的地域列表 |
regions[#] |
str | 必须 | 地域 ID。如:'ap-nanjing' 总表见附录 |
2. 配置示例¶
指定地域¶
采集南京地域的 MongoDB 慢查询日志数据
3. 数据上报格式¶
数据正常同步后,可以在 观测云 的「日志」中查看数据。
上报的数据示例如下:
{
"measurement": "tencentcloud_postgre_slowlog",
"tags": {
"AppId" : "131185",
"DBCharset" : "UTF8",
"DBEngine" : "postgresql",
"DBEngineConfig" : "",
"DBInstanceClass" : "cdb.pg.ts1.2g",
"DBInstanceId" : "postgres-3coh1xgm",
"DBInstanceName" : "Unnamed",
"DBInstanceStatus" : "running",
"DBInstanceType" : "primary",
"DBInstanceVersion": "standard",
"DBVersion" : "10.17",
"DatabaseName" : "postgres",
"PayType" : "postpaid",
"ProjectId" : "0",
"Region" : "ap-shanghai",
"RegionId" : "ap-shanghai",
"SubnetId" : "subnet-bp2jqhcj",
"Type" : "TS85",
"Uid" : "4147",
"UserName" : "postgres",
"VpcId" : "vpc-kcphyzty",
"Zone" : "ap-shanghai-2",
"name" : "postgres-3coh1xgm"
},
"fields": {
"ClientAddr" : "::1:34301",
"Duration" : "155.283",
"RawQuery" : "select count(*)::text as value from pg_stat_activity where now()-backend_start < '5 second';",
"SessionStartTime": "2021-07-25 02:25:09 CST",
"message" : "{慢查询 JSON 数据}"
}
}
Note
tags、fields 中的字段可能会随后续更新有所变动
Tip
tags 值由自定义对象补充
Tip
fields.message 为 JSON 序列化后字符串
X. 附录¶
TencentCloud-PostgreSQL「地域」¶
请参考 Tencent 官方文档:
TencentCloud-PostgreSQL「慢日志详情信息说明文档」¶
请参考 Tencent 官方文档: