From acd0caa5f79117ed85cf86de046932852c2de490 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 8 Mar 2018 13:18:32 +0100 Subject: dashboard/app: log api method/client Since we now don't have them in URL, log them explicitly. --- dashboard/app/api.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 33a2b488b..02ac5e0c5 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -85,7 +85,10 @@ func handleJSON(fn JSONHandler) http.Handler { } func handleAPI(c context.Context, r *http.Request) (reply interface{}, err error) { - ns, err := checkClient(c, r.PostFormValue("client"), r.PostFormValue("key")) + client := r.PostFormValue("client") + method := r.PostFormValue("method") + log.Infof(c, "api %q from %q", method, client) + ns, err := checkClient(c, client, r.PostFormValue("key")) if err != nil { log.Warningf(c, "%v", err) return nil, fmt.Errorf("unauthorized request") @@ -104,7 +107,6 @@ func handleAPI(c context.Context, r *http.Request) (reply interface{}, err error return nil, fmt.Errorf("failed to ungzip payload: %v", err) } } - method := r.PostFormValue("method") handler := apiHandlers[method] if handler != nil { return handler(c, r, payload) -- cgit mrf-deployment