From 6717295e182aa5bc16d2eec4e14ba4f74a83fea4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 26 Jan 2021 13:39:55 -0800 Subject: [PATCH] fix: rename audit log docs and datastructure --- cmd/erasure-sets.go | 12 ++++++------ cmd/logger/message/audit/entry.go | 4 +++- docs/logging/README.md | 25 +++++++++++++------------ 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/cmd/erasure-sets.go b/cmd/erasure-sets.go index 9f5069d52..3e44d14de 100644 --- a/cmd/erasure-sets.go +++ b/cmd/erasure-sets.go @@ -455,9 +455,9 @@ func (s *erasureSets) cleanupStaleUploads(ctx context.Context, cleanupInterval, const objectErasureMapKey = "objectErasureMap" type auditObjectOp struct { - Pool int `json:"pool"` - Set int `json:"set"` - BackendServers []string `json:"backendServers"` + Pool int `json:"poolId"` + Set int `json:"setId"` + Disks []string `json:"disks"` } func auditObjectErasureSet(ctx context.Context, object string, set *erasureObjects, poolNum int) { @@ -468,9 +468,9 @@ func auditObjectErasureSet(ctx context.Context, object string, set *erasureObjec object = decodeDirObject(object) op := auditObjectOp{ - Pool: poolNum + 1, - Set: set.setNumber + 1, - BackendServers: set.getEndpoints(), + Pool: poolNum + 1, + Set: set.setNumber + 1, + Disks: set.getEndpoints(), } var objectErasureSetTag map[string]auditObjectOp diff --git a/cmd/logger/message/audit/entry.go b/cmd/logger/message/audit/entry.go index 18887248b..b00214a62 100644 --- a/cmd/logger/message/audit/entry.go +++ b/cmd/logger/message/audit/entry.go @@ -68,7 +68,9 @@ func ToEntry(w http.ResponseWriter, r *http.Request, reqClaims map[string]interf for k, v := range wh { respHeader[k] = strings.Join(v, ",") } - respHeader[xhttp.ETag] = strings.Trim(respHeader[xhttp.ETag], `"`) + if etag := respHeader[xhttp.ETag]; etag != "" { + respHeader[xhttp.ETag] = strings.Trim(etag, `"`) + } entry := Entry{ Version: Version, diff --git a/docs/logging/README.md b/docs/logging/README.md index 111f82fed..81cdd2b5a 100644 --- a/docs/logging/README.md +++ b/docs/logging/README.md @@ -60,10 +60,10 @@ Setting this environment variable automatically enables audit logging to the HTT NOTE: - `timeToFirstByte` and `timeToResponse` will be expressed in Nanoseconds. -- In the case of the erasure setup `tags.objectErasureMap` provides - - Pool number - - Set number - - The list of disks belonging to the set +- Additionally in the case of the erasure coded setup `tags.objectErasureMap` provides per object details about + - Pool number the object operation was performed on. + - Set number the object operation was performed on. + - The list of disks participating in this operation belong to the set. ```json { @@ -103,15 +103,16 @@ NOTE: }, "tags": { "objectErasureMap": { - "pool": 1, - "set": 10, - "path/to/object": [ - "http://minio.example.com/mnt/zone1/disk1", - "http://minio.example.com/mnt/zone1/disk2", - "http://minio.example.com/mnt/zone1/disk3", - "http://minio.example.com/mnt/zone1/disk4" + "object": { + "poolId": 1, + "setId": 10, + "disks": [ + "http://server01/mnt/pool1/disk01", + "http://server02/mnt/pool1/disk02", + "http://server03/mnt/pool1/disk03", + "http://server04/mnt/pool1/disk04" ] - } + } } } ```