# 13.2 系统消息事件配置
默认情况下,Juno 系统会将事件写入名为 appevent 的数据表中。如果你希望通过 MQ 获取 Juno 系统的事件,那么可以通过下述配置来实现。目前系统事件消息只支持了 RocketMQ。
# 配置示例
[junoevent.rocketmq]
enable = false # 开关.如果为false,则系统事件不写MQ.
addr = ["127.0.0.1:9876"] # mq地址
topic = "juno_test_job" # mq topic
group = "juno_devops_go" # mq producer group
retry = 3 # MQ写重试次数
dialTimeout = "3s" # MQ连接超时时间
1
2
3
4
5
6
7
2
3
4
5
6
7
# 配置项说明
| 配置项 | 字段说明 | 示例值 | 
|---|---|---|
| enable | 开关。是否打开本功能,如果为 true , JUNO 系统事件会发送消息到配置的 MQ | true | 
| addr | MQ 地址 | ["127.0.0.1:9876"] | 
| topic | RocketMQ 的Topic名称 | "xxxx" | 
| group | Producer Group 名称 | xxx | 
| retry | 重试次数 | 3 | 
| dialTimeout | 连接超时时间 | "3s" | 
# 消息格式
{
    "id": 1,                // 事件ID
    "app_name": "",         // 应用名称
    "aid": "",              // 应用ID
    "zone_code": "",        // Zone Code
    "env": "",              // 环境
    "host_name": "",        // 主机名称
    "operator_type": "",    // 用户类型 (user | openapi)
    "user_name": "",        // 用户名
    "uid": "",              // 用户ID
    "operation": "",        // 事件类型
    "create_time": "",      // 事件创建时间
    "source": "",           // 来源
    "metadata": "",         // 事件详情 (与事件类型有关)
    "operation_name": "",   // 事件操作名称
    "source_name": ""       // 来源名称
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 消息字段说明
| 字段名 | 说明 | 
|---|---|
| id | 事件ID | 
| app_name | 应用名称 | 
| aid | 应用ID | 
| zone_code | Zone Code | 
| env | 环境 | 
| host_name | 主机名称 | 
| operator_type | 用户类型 (user: 用户操作; openapi: 通过OpenAPI操作) | 
| user_name | 用户名 | 
| uid | 用户ID | 
| operation | 事件类型,见 事件类型 | 
| create_time | 事件创建时间 | 
| source | 来源,见 来源 | 
| metadata | 事件详情 (与事件类型有关,不同的事件类型数据格式不同) | 
| operation_name | 事件操作名称 | 
| source_name | 来源名称 | 
事件消息示例:
{
    "id": 11979,
    "app_name": "bj-im-srv-tencent-callback-go",
    "aid": 14185,
    "zone_code": "ALIYUN-HB2-G",
    "env": "prod",
    "host_name": "",
    "user_name": "杜旻翔_gitlab",
    "uid": 1,
    "operation": "confgo_file_update",
    "create_time": 1603942730,
    "source": "confgo",
    "metadata": "{\"access_token_id\":0,\"change_log\":\"1\",\"configuration_id\":988,\"format\":\"toml\",\"id\":0,\"name\":\"test\",\"uid\":1,\"version\":\"50347a3f14aea923e9f8eac867fd3bb1\"}",
    "operator_type": "user"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 事件类型
| 事件类型 | 说明 | 
|---|---|
| confgo_file_create | 配置创建 | 
| confgo_file_update | 配置更新 | 
| confgo_file_delete | 配置删除 | 
| confgo_file_publish | 配置发布 | 
| confgo_file_rollback | 配置回滚 | 
| app_node_restart | 应用重启 | 
| grafana_alert_notification | Grafana监控告警 | 
# 来源类型
| Source | 说明 | 
|---|---|
| confgo | 配置中心 | 
| git | git 事件 | 
| devops | 发布事件 | 
| grafana | 监控告警 |