提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.gateway.filter.logging; |
H |
2 |
|
|
3 |
import lombok.Data; |
|
4 |
import org.springframework.cloud.gateway.route.Route; |
|
5 |
import org.springframework.http.HttpStatus; |
|
6 |
import org.springframework.util.MultiValueMap; |
|
7 |
|
|
8 |
import java.time.LocalDateTime; |
|
9 |
|
|
10 |
/** |
|
11 |
* 网关的访问日志 |
|
12 |
*/ |
|
13 |
@Data |
|
14 |
public class AccessLog { |
|
15 |
|
|
16 |
/** |
|
17 |
* 链路追踪编号 |
|
18 |
*/ |
|
19 |
private String traceId; |
|
20 |
/** |
|
21 |
* 用户编号 |
|
22 |
*/ |
|
23 |
private Long userId; |
|
24 |
/** |
|
25 |
* 用户类型 |
|
26 |
*/ |
|
27 |
private Integer userType; |
|
28 |
/** |
|
29 |
* 路由 |
|
30 |
* |
|
31 |
* 类似 ApiAccessLogCreateReqDTO 的 applicationName |
|
32 |
*/ |
|
33 |
private Route route; |
|
34 |
|
|
35 |
/** |
|
36 |
* 协议 |
|
37 |
*/ |
|
38 |
private String schema; |
|
39 |
/** |
|
40 |
* 请求方法名 |
|
41 |
*/ |
|
42 |
private String requestMethod; |
|
43 |
/** |
|
44 |
* 访问地址 |
|
45 |
*/ |
|
46 |
private String requestUrl; |
|
47 |
/** |
|
48 |
* 查询参数 |
|
49 |
*/ |
|
50 |
private MultiValueMap<String, String> queryParams; |
|
51 |
/** |
|
52 |
* 请求体 |
|
53 |
*/ |
|
54 |
private String requestBody; |
|
55 |
/** |
|
56 |
* 请求头 |
|
57 |
*/ |
|
58 |
private MultiValueMap<String, String> requestHeaders; |
|
59 |
/** |
|
60 |
* 用户 IP |
|
61 |
*/ |
|
62 |
private String userIp; |
|
63 |
|
|
64 |
/** |
|
65 |
* 响应体 |
|
66 |
* |
|
67 |
* 类似 ApiAccessLogCreateReqDTO 的 resultCode + resultMsg |
|
68 |
*/ |
|
69 |
private String responseBody; |
|
70 |
/** |
|
71 |
* 响应头 |
|
72 |
*/ |
|
73 |
private MultiValueMap<String, String> responseHeaders; |
|
74 |
/** |
|
75 |
* 响应结果 |
|
76 |
*/ |
|
77 |
private HttpStatus httpStatus; |
|
78 |
|
|
79 |
/** |
|
80 |
* 开始请求时间 |
|
81 |
*/ |
|
82 |
private LocalDateTime startTime; |
|
83 |
/** |
|
84 |
* 结束请求时间 |
|
85 |
*/ |
|
86 |
private LocalDateTime endTime; |
|
87 |
/** |
|
88 |
* 执行时长,单位:毫秒 |
|
89 |
*/ |
|
90 |
private Integer duration; |
|
91 |
|
|
92 |
} |