Skip to content

Commit

Permalink
Add some more log fields
Browse files Browse the repository at this point in the history
  • Loading branch information
brackendawson committed Sep 25, 2024
1 parent 6bfea24 commit e680ada
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ location /webcal-proxy/ {
rewrite ^/webcal-proxy/(.*)$ /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-URI /webcal-proxy;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
}
Expand Down
9 changes: 6 additions & 3 deletions logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ func logging(c *gin.Context) {
start := time.Now()

log := logrus.WithFields(logrus.Fields{
"req_method": c.Request.Method,
"req_url": c.Request.URL.String(),
"req_bytes": c.GetHeader("Content-Length"),
"req_method": c.Request.Method,
"req_url": c.Request.URL.String(),
"req_bytes": c.GetHeader("Content-Length"),
"downstream_remote_addr": c.Request.RemoteAddr,
"x_forwarded_for": c.GetHeader("X-Forwarded-For"),
"user_agent": c.GetHeader("User-Agent"),
})

requestID := c.GetHeader("X-Request-ID")
Expand Down

0 comments on commit e680ada

Please sign in to comment.