mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(dataproxy): moves all parameters to Info call
This commit is contained in:
parent
839eb97061
commit
51bca7d84b
@ -18,6 +18,10 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/util"
|
"github.com/grafana/grafana/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
auditLogger log.Logger = log.New("data-proxy-log")
|
||||||
|
)
|
||||||
|
|
||||||
func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *httputil.ReverseProxy {
|
func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *httputil.ReverseProxy {
|
||||||
director := func(req *http.Request) {
|
director := func(req *http.Request) {
|
||||||
req.URL.Scheme = targetUrl.Scheme
|
req.URL.Scheme = targetUrl.Scheme
|
||||||
@ -133,7 +137,6 @@ func ProxyDataSourceRequest(c *middleware.Context) {
|
|||||||
|
|
||||||
func proxyLog(dataSourceType string, c *middleware.Context) {
|
func proxyLog(dataSourceType string, c *middleware.Context) {
|
||||||
if setting.DataProxyLogging {
|
if setting.DataProxyLogging {
|
||||||
auditLogger := log.New("data-proxy-log", "userid", c.UserId, "orgid", c.OrgId, "username", c.Login)
|
|
||||||
|
|
||||||
var body string
|
var body string
|
||||||
if c.Req.Request.Body != nil {
|
if c.Req.Request.Body != nil {
|
||||||
@ -142,6 +145,13 @@ func proxyLog(dataSourceType string, c *middleware.Context) {
|
|||||||
body = string(buffer)
|
body = string(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
auditLogger.Info("Proxying incoming request", "datasource", dataSourceType, "uri", c.Req.RequestURI, "method", c.Req.Request.Method, "body", body)
|
auditLogger.Info("Proxying incoming request",
|
||||||
|
"userid", c.UserId,
|
||||||
|
"orgid", c.OrgId,
|
||||||
|
"username", c.Login,
|
||||||
|
"datasource", dataSourceType,
|
||||||
|
"uri", c.Req.RequestURI,
|
||||||
|
"method", c.Req.Request.Method,
|
||||||
|
"body", body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user