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