此版本仍在开发中,尚未视为稳定版。如需最新稳定版本,请使用 Spring Boot 4.0.4spring-doc.cadn.net.cn

审计事件(auditevents

auditevents 端点提供有关应用程序审计事件的信息。spring-doc.cadn.net.cn

检索审计事件

要获取审计事件,请向 GET 发起一个 /actuator/auditevents 请求,如下列基于 curl 的示例所示:spring-doc.cadn.net.cn

$ curl 'http://localhost:8080/actuator/auditevents?principal=alice&after=2017-11-07T09%3A37Z&type=logout' -i -X GET

前面的示例检索了主体 logout 在 UTC 时区 2017 年 11 月 7 日 09:37 之后发生的 alice 事件。 返回的结果响应类似于以下内容:spring-doc.cadn.net.cn

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"
  } ]
}

查询参数

该端点使用查询参数来限制其返回的事件。 下表列出了支持的查询参数:spring-doc.cadn.net.cn

参数 <description> </description>

afterspring-doc.cadn.net.cn

将事件限制为在给定时间之后发生的事件。可选。spring-doc.cadn.net.cn

principalspring-doc.cadn.net.cn

将事件限制为指定主体(principal)的事件。可选。spring-doc.cadn.net.cn

typespring-doc.cadn.net.cn

将事件限制为指定类型的事件。可选。spring-doc.cadn.net.cn

响应结构

响应包含所有匹配查询的审计事件的详细信息。 下表描述了响应的结构:spring-doc.cadn.net.cn

路径 类型 <description> </description>

eventsspring-doc.cadn.net.cn

Arrayspring-doc.cadn.net.cn

一组审计事件。spring-doc.cadn.net.cn

events.[].timestampspring-doc.cadn.net.cn

Stringspring-doc.cadn.net.cn

事件发生的时间戳。spring-doc.cadn.net.cn

events.[].principalspring-doc.cadn.net.cn

Stringspring-doc.cadn.net.cn

触发该事件的主体。spring-doc.cadn.net.cn

events.[].typespring-doc.cadn.net.cn

Stringspring-doc.cadn.net.cn

事件的类型。spring-doc.cadn.net.cn