mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
Support audit logs with additional fields (#6738)
This PR adds support - Request query params - Request headers - Response headers AuditLogEntry is exported and versioned as well starting with this PR.
This commit is contained in:
committed by
Dee Koder
parent
3f19ea98bb
commit
bef0318c36
@@ -176,14 +176,26 @@ func getRedirectPostRawQuery(objInfo ObjectInfo) string {
|
||||
return redirectValues.Encode()
|
||||
}
|
||||
|
||||
// Returns access key in the request Authorization header.
|
||||
func getReqAccessKey(r *http.Request, region string) (accessKey string) {
|
||||
accessKey, _, _ = getReqAccessKeyV4(r, region)
|
||||
if accessKey == "" {
|
||||
accessKey, _, _ = getReqAccessKeyV2(r)
|
||||
}
|
||||
return accessKey
|
||||
}
|
||||
|
||||
// Extract request params to be sent with event notifiation.
|
||||
func extractReqParams(r *http.Request) map[string]string {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
region := globalServerConfig.GetRegion()
|
||||
// Success.
|
||||
return map[string]string{
|
||||
"region": region,
|
||||
"accessKey": getReqAccessKey(r, region),
|
||||
"sourceIPAddress": handlers.GetSourceIP(r),
|
||||
// Add more fields here.
|
||||
}
|
||||
@@ -193,6 +205,7 @@ func extractReqParams(r *http.Request) map[string]string {
|
||||
func extractRespElements(w http.ResponseWriter) map[string]string {
|
||||
|
||||
return map[string]string{
|
||||
"requestId": w.Header().Get(responseRequestIDKey),
|
||||
"content-length": w.Header().Get("Content-Length"),
|
||||
// Add more fields here.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user