mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
add Referer header to logs. This is useful to link datasource requests to dashboard that originated it (#8399)
This commit is contained in:
parent
8b7a0100b1
commit
ac28c4b233
@ -49,9 +49,9 @@ func Logger() macaron.Handler {
|
|||||||
if ctx, ok := c.Data["ctx"]; ok {
|
if ctx, ok := c.Data["ctx"]; ok {
|
||||||
ctxTyped := ctx.(*Context)
|
ctxTyped := ctx.(*Context)
|
||||||
if status == 500 {
|
if status == 500 {
|
||||||
ctxTyped.Logger.Error("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", int64(timeTakenMs), "size", rw.Size())
|
ctxTyped.Logger.Error("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", int64(timeTakenMs), "size", rw.Size(), "referer", req.Referer())
|
||||||
} else {
|
} else {
|
||||||
ctxTyped.Logger.Info("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", int64(timeTakenMs), "size", rw.Size())
|
ctxTyped.Logger.Info("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", int64(timeTakenMs), "size", rw.Size(), "referer", req.Referer())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user