From 791702a202e4c9986bb4d8f10757a93a837e3ec4 Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Tue, 24 Sep 2024 13:00:54 -0400 Subject: [PATCH] Add missing monitoring attributes for log record, issue #33 --- logging/logging.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/logging/logging.go b/logging/logging.go index c283cfc..9649fbc 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -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 @@ -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()