Audit Events (auditevents)
auditevents)
auditevents 端点提供有关应用程序审计事件的信息。
检索审计事件
要检索审计事件,请向 /actuator/auditevents 发起一个 GET 请求,如下列基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/auditevents?principal=alice&after=2017-11-07T09%3A37Z&type=logout' -i -X GET
前面的示例检索了主体 alice 在 UTC 时区 2017 年 11 月 7 日 09:37 之后发生的 logout 事件。返回的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 117
{
"events" : [ {
"timestamp" : "2017-11-07T09:38:13Z",
"principal" : "alice",
"type" : "logout"
} ]
}
查询参数
该端点使用查询参数来限制其返回的事件。下表列出了支持的查询参数:
| 参数 | 描述 |
|---|---|
after | 限制事件为在给定时间之后发生的事件。可选。 |
principal | 限制事件为具有给定 principal 的事件。可选。 |
type | 限制事件为具有给定类型的事件。可选。 |
响应结构
响应包含与查询匹配的所有审计事件的详细信息。下表描述了响应的结构:
| 路径(Path) | 类型(Type) | 描述(Description) |
|---|---|---|
events | Array | 审计事件的数组。 |
events.[].timestamp | String | 事件发生的时间戳。 |
events.[].principal | String | 触发该事件的主体(principal)。 |
events.[].type | String | 事件的类型。 |