Skip to content

Commit

Permalink
Add missing monitoring attributes for log record, issue #33
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Sep 24, 2024
1 parent 117960f commit 791702a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ type LogRecord struct {
Timestamp int64 `json:"timestamp"` // record timestamp
RecTimestamp int64 `json:"rec_timestamp"` // timestamp for backward compatibility with apache
RecDate string `json:"rec_date"` // timestamp for backward compatibility with apache

// additional fields required by monitoring
CmswebEnv string `json:"cmsweb_env"` // cmsweb environment
CmswebCluster string `json:"cmsweb_cluster"` // cmsweb cluster
ClientVersion string `json:"client_version"` // client version
ProxyServer string `json:"proxy_server"` // proxy server
}

// UTC flag represents UTC time zone for log messages
Expand Down Expand Up @@ -369,6 +375,10 @@ func LogRequest(w http.ResponseWriter, r *http.Request, start time.Time, cauth s
Timestamp: tstamp,
RecTimestamp: int64(time.Now().Unix()),
RecDate: time.Now().Format(time.RFC3339),
CmswebEnv: os.Getenv("CMSWEB_ENV"),
CmswebCluster: os.Getenv("CMSWEB_CLUSTER"),
ClientVersion: userAgentName(r.Header.Get("User-Agent")),
ProxyServer: os.Getenv("APS_SERVER"),
}
// print monit record
hostname, err := os.Hostname()
Expand Down

0 comments on commit 791702a

Please sign in to comment.