审计事件(auditevents

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

获取审计事件

要获取审计事件,请对 /actuator/auditevents 发起 GET 请求,如下所示(基于 curl 的示例):

$ curl 'http://localhost:8080/actuator/auditevents?principal=alice&after=2025-05-26T11%3A07%3A51.153361%2B08%3A00&type=logout' -i -X GET

上述示例检索了主体 alice 在 2017 年 11 月 7 日 09:37(UTC 时区)之后发生的 logout 事件。 返回的响应类似如下:

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

{
  "events" : [ {
    "timestamp" : "2025-05-26T03:07:51.153785Z",
    "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.