审计事件 (auditevents)

auditevents 端点提供有关应用程序审计事件的信息。

获取审计事件

要获取审计事件,向 /actuator/auditevents 发送 GET 请求,如下面的基于 curl 的示例所示:

$ curl 'http://localhost:8080/actuator/auditevents?principal=alice&after=2025-05-25T18%3A02%3A36.531435%2B08%3A00&type=logout' -i -X GET

前面的示例获取了在 2017 年 11 月 7 日 UTC 时区 09:37 之后发生的、主体为 alicelogout 事件。 响应结果类似于以下内容:

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 124

{
  "events" : [ {
    "timestamp" : "2025-05-25T10:02:36.531855Z",
    "principal" : "alice",
    "type" : "logout"
  } ]
}

查询参数

该端点使用查询参数来限制返回的事件。 下表显示了支持的查询参数:

Parameter Description

after

Restricts the events to those that occurred after the given time. Optional.

principal

Restricts the events to those with the given principal. Optional.

type

Restricts the events to those with the given type. Optional.

响应结构

响应包含与查询匹配的所有审计事件的详细信息。 下表描述了响应的结构:

Path Type Description

events

Array

An array of audit events.

events.[].timestamp

String

The timestamp of when the event occurred.

events.[].principal

String

The principal that triggered the event.

events.[].type

String

The type of the event.