diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c40da47b33..6260a6b2d34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ * [ENHANCEMENT] Added per tenant metrics for queries and chunks and bytes read from chunk store: #2463 * `cortex_chunk_store_fetched_chunks_total` and `cortex_chunk_store_fetched_chunk_bytes_total` * `cortex_query_frontend_queries_total` (per tenant queries counted by the frontend) +* [ENHANCEMENT] query-frontend now also logs the POST data of long queries. #2481 * [BUGFIX] Fixes #2411, Ensure requests are properly routed to the prometheus api embedded in the query if `-server.path-prefix` is set. #2372 * [BUGFIX] Experimental TSDB: fixed chunk data corruption when querying back series using the experimental blocks storage. #2400 * [BUGFIX] Cassandra Storage: Fix endpoint TLS host verification. #2109 diff --git a/pkg/querier/frontend/frontend.go b/pkg/querier/frontend/frontend.go index 1306646c568..f8f8a8ddaa1 100644 --- a/pkg/querier/frontend/frontend.go +++ b/pkg/querier/frontend/frontend.go @@ -163,7 +163,16 @@ func (f *Frontend) handle(w http.ResponseWriter, r *http.Request) { queryResponseTime := time.Since(startTime) if f.cfg.LogQueriesLongerThan > 0 && queryResponseTime > f.cfg.LogQueriesLongerThan { - level.Info(f.log).Log("msg", "slow query", "org_id", userID, "url", fmt.Sprintf("http://%s", r.Host+r.RequestURI), "time_taken", queryResponseTime.String()) + logMessage := []interface{}{"msg", "slow query", + "org_id", userID, + "url", fmt.Sprintf("http://%s", r.Host+r.RequestURI), + "time_taken", queryResponseTime.String(), + } + pf := r.PostForm.Encode() + if pf != "" { + logMessage = append(logMessage, "body", pf) + } + level.Info(f.log).Log(logMessage...) } if err != nil {