mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Remove DeploymentID from response headers (#7815)
Response headers need not contain deployment ID.
This commit is contained in:
@@ -63,6 +63,6 @@ func AuditLog(w http.ResponseWriter, r *http.Request, api string, reqClaims map[
|
||||
}
|
||||
// Send audit logs only to http targets.
|
||||
for _, t := range AuditTargets {
|
||||
_ = t.Send(audit.ToEntry(w, r, api, statusCode, reqClaims))
|
||||
_ = t.Send(audit.ToEntry(w, r, api, statusCode, reqClaims, globalDeploymentID))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@ const (
|
||||
|
||||
var trimStrings []string
|
||||
|
||||
var globalDeploymentID string
|
||||
|
||||
// TimeFormat - logging time format.
|
||||
const TimeFormat string = "15:04:05 MST 01/02/2006"
|
||||
|
||||
@@ -154,6 +156,11 @@ func uniqueEntries(paths []string) []string {
|
||||
return m.ToSlice()
|
||||
}
|
||||
|
||||
// SetDeploymentID -- Deployment Id from the main package is set here
|
||||
func SetDeploymentID(deploymentID string) {
|
||||
globalDeploymentID = deploymentID
|
||||
}
|
||||
|
||||
// Init sets the trimStrings to possible GOPATHs
|
||||
// and GOROOT directories. Also append github.com/minio/minio
|
||||
// This is done to clean up the filename, when stack trace is
|
||||
@@ -317,7 +324,9 @@ func logIf(ctx context.Context, err error) {
|
||||
|
||||
// Get the cause for the Error
|
||||
message := err.Error()
|
||||
|
||||
if req.DeploymentID == "" {
|
||||
req.DeploymentID = globalDeploymentID
|
||||
}
|
||||
entry := log.Entry{
|
||||
DeploymentID: req.DeploymentID,
|
||||
Level: ErrorLvl.String(),
|
||||
|
||||
@@ -50,7 +50,7 @@ type Entry struct {
|
||||
}
|
||||
|
||||
// ToEntry - constructs an audit entry object.
|
||||
func ToEntry(w http.ResponseWriter, r *http.Request, api string, statusCode int, reqClaims map[string]interface{}) Entry {
|
||||
func ToEntry(w http.ResponseWriter, r *http.Request, api string, statusCode int, reqClaims map[string]interface{}, deploymentID string) Entry {
|
||||
vars := mux.Vars(r)
|
||||
bucket := vars["bucket"]
|
||||
object := vars["object"]
|
||||
@@ -71,7 +71,7 @@ func ToEntry(w http.ResponseWriter, r *http.Request, api string, statusCode int,
|
||||
|
||||
entry := Entry{
|
||||
Version: Version,
|
||||
DeploymentID: w.Header().Get("x-minio-deployment-id"),
|
||||
DeploymentID: deploymentID,
|
||||
RemoteHost: handlers.GetSourceIP(r),
|
||||
RequestID: w.Header().Get("x-amz-request-id"),
|
||||
UserAgent: r.UserAgent(),
|
||||
|
||||
Reference in New Issue
Block a user