Support reverse proxy IP logging.

This commit is contained in:
MaxJa4
2024-01-22 18:07:21 +01:00
parent ef3117ea2a
commit 37f9396428
2 changed files with 3 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o isc .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -v -o isc .
FROM alpine:latest

View File

@@ -99,10 +99,11 @@ func customLogrusLogger(logger *logrus.Logger) gin.HandlerFunc {
username = "Anonymous"
}
logger.Infof("[GIN] %3d | %10.3fms | %15s | %15s | %-7s | %s",
logger.Infof("[GIN] %3d | %10.3fms | %15s | %15s | %15s | %-7s | %s",
c.Writer.Status(),
float64(elapsed.Microseconds())/1000.0,
c.ClientIP(),
c.Request.Header.Get("X-Forwarded-For"),
username,
c.Request.Method,
c.Request.RequestURI,