This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_10_0 in repository https://gitbox.apache.org/repos/asf/solr.git
commit 0b75f468c33610272f9c8c01555166f6df98effd Author: David Smiley <[email protected]> AuthorDate: Wed Oct 15 16:48:59 2025 -0400 Logs: don't add webapp=/solr (#3758) And remove webapp from the context map as well. --- solr/CHANGES.txt | 2 ++ solr/core/src/java/org/apache/solr/core/SolrCore.java | 13 ++++--------- .../src/java/org/apache/solr/rest/BaseSolrResource.java | 7 ------- .../src/java/org/apache/solr/servlet/HttpSolrCall.java | 4 ---- .../src/test/org/apache/solr/cli/PostLogsToolTest.java | 14 +++++++------- .../modules/configuration-guide/pages/config-api.adoc | 1 - .../pages/package-manager-internals.adoc | 2 -- .../upgrade-notes/pages/major-changes-in-solr-10.adoc | 7 +++++-- 8 files changed, 18 insertions(+), 32 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index af57601313e..15fee445e5c 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -525,6 +525,8 @@ Other Changes apparently has negligible impact on search performance so it's used now for all queries regardless of their query limits params. (Andrzej Bialecki) +* PR#3758: Logs: removed webapp=/solr and also removed from internal context map. + ================== 9.10.0 ================== New Features --------------------- diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java index 57e7fc528c1..5beca634fe3 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrCore.java +++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java @@ -2981,18 +2981,13 @@ public class SolrCore implements SolrInfoBean, Closeable { final NamedList<Object> responseHeader = new SimpleOrderedMap<>(); rsp.addResponseHeader(responseHeader); - // toLog is a local ref to the same NamedList used by the response - NamedList<Object> toLog = rsp.getToLog(); - - // for back compat, we set these now just in case other code - // are expecting them during handleRequest - toLog.add("webapp", req.getContext().get("webapp")); - toLog.add(PATH, req.getContext().get(PATH)); + rsp.addToLog(PATH, req.getContext().get(PATH)); + // params: final SolrParams params = req.getParams(); final String lpList = params.get(CommonParams.LOG_PARAMS_LIST); if (lpList == null) { - toLog.add("params", "{" + req.getParamString() + "}"); + rsp.addToLog("params", "{" + req.getParamString() + "}"); } else if (lpList.length() > 0) { // Filter params by those in LOG_PARAMS_LIST so that we can then call toString @@ -3022,7 +3017,7 @@ public class SolrCore implements SolrInfoBean, Closeable { } // assume in lpSet }; - toLog.add("params", "{" + filteredParams + "}"); + rsp.addToLog("params", "{" + filteredParams + "}"); } } diff --git a/solr/core/src/java/org/apache/solr/rest/BaseSolrResource.java b/solr/core/src/java/org/apache/solr/rest/BaseSolrResource.java index 0ecb8b4f101..2591a9f1fe3 100644 --- a/solr/core/src/java/org/apache/solr/rest/BaseSolrResource.java +++ b/solr/core/src/java/org/apache/solr/rest/BaseSolrResource.java @@ -92,13 +92,6 @@ public abstract class BaseSolrResource { String responseWriterName = solrRequest.getParams().get(CommonParams.WT, JSON); responseWriter = solrCore.getQueryResponseWriter(responseWriterName); contentType = responseWriter.getContentType(solrRequest, solrResponse); - final String path = solrRequest.getPath(); - if (!RestManager.SCHEMA_BASE_PATH.equals(path)) { - // don't set webapp property on the request when context and core/collection are excluded - final int cutoffPoint = path.indexOf('/', 1); - final String firstPathElement = -1 == cutoffPoint ? path : path.substring(0, cutoffPoint); - solrRequest.getContext().put("webapp", firstPathElement); // Context path - } // client application can set a timeout for update requests String updateTimeoutSecsParam = solrRequest.getParams().get(UPDATE_TIMEOUT_SECS); diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java index c0b78fc1a9f..24ec79d1e5f 100644 --- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java +++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java @@ -719,10 +719,6 @@ public class HttpSolrCall { } protected void executeCoreRequest(SolrQueryResponse rsp) { - // a custom filter could add more stuff to the request before passing it on. - // for example: sreq.getContext().put( "HttpServletRequest", req ); - // used for logging query stats in SolrCore.execute() - solrReq.getContext().put("webapp", req.getContextPath()); solrReq.getCore().execute(handler, solrReq, rsp); } diff --git a/solr/core/src/test/org/apache/solr/cli/PostLogsToolTest.java b/solr/core/src/test/org/apache/solr/cli/PostLogsToolTest.java index dfde71b4bda..5f2089bb5f0 100644 --- a/solr/core/src/test/org/apache/solr/cli/PostLogsToolTest.java +++ b/solr/core/src/test/org/apache/solr/cli/PostLogsToolTest.java @@ -46,7 +46,7 @@ public class PostLogsToolTest extends SolrTestCaseJ4 { public void testQueryRecord() throws Exception { String record = sometimesSolr9Format( - "2019-12-09 15:05:11.931 INFO (qtp2103763750-21) [c:logs4 s:shard1 r:core_node2 x:logs4_shard1_replica_n1] o.a.s.c.S.Request [logs4_shard1_replica_n1] webapp=/solr path=/select params={q=*:*&_=1575835181759&shards.purpose=36&isShard=true&wt=javabin&distrib=false} hits=234868 status=0 QTime=8\n"); + "2019-12-09 15:05:11.931 INFO (qtp2103763750-21) [c:logs4 s:shard1 r:core_node2 x:logs4_shard1_replica_n1] o.a.s.c.S.Request [logs4_shard1_replica_n1] path=/select params={q=*:*&_=1575835181759&shards.purpose=36&isShard=true&wt=javabin&distrib=false} hits=234868 status=0 QTime=8\n"); List<SolrInputDocument> docs = readDocs(record); assertEquals(docs.size(), 1); SolrInputDocument doc = docs.get(0); @@ -99,7 +99,7 @@ public class PostLogsToolTest extends SolrTestCaseJ4 { public void testRecordsFirstInstanceOfSingleValuedParams() throws Exception { final String record = sometimesSolr9Format( - "2019-12-09 15:05:01.931 INFO (qtp2103763750-21) [c:logs4 s:shard1 r:core_node2 x:logs4_shard1_replica_n1] o.a.s.c.S.Request [logs4_shard1_replica_n1] webapp=/solr path=/select params={q=*:*&q=inStock:true&_=1575835181759&shards.purpose=36&isShard=true&wt=javabin&wt=xml&distrib=false} hits=234868 status=0 QTime=8\n"); + "2019-12-09 15:05:01.931 INFO (qtp2103763750-21) [c:logs4 s:shard1 r:core_node2 x:logs4_shard1_replica_n1] o.a.s.c.S.Request [logs4_shard1_replica_n1] path=/select params={q=*:*&q=inStock:true&_=1575835181759&shards.purpose=36&isShard=true&wt=javabin&wt=xml&distrib=false} hits=234868 status=0 QTime=8\n"); List<SolrInputDocument> docs = readDocs(record); assertEquals(docs.size(), 1); @@ -116,7 +116,7 @@ public class PostLogsToolTest extends SolrTestCaseJ4 { public void testRTGRecord() throws Exception { final String record = sometimesSolr9Format( - "2020-03-19 20:00:30.845 INFO (qtp1635378213-20354) [c:logs4 s:shard8 r:core_node63 x:logs4_shard8_replica_n60] o.a.s.c.S.Request [logs4_shard8_replica_n60] webapp=/solr path=/get params={qt=/get&_stateVer_=logs4:104&ids=id1&ids=id2&ids=id3&wt=javabin} status=0 QTime=61"); + "2020-03-19 20:00:30.845 INFO (qtp1635378213-20354) [c:logs4 s:shard8 r:core_node63 x:logs4_shard8_replica_n60] o.a.s.c.S.Request [logs4_shard8_replica_n60] path=/get params={qt=/get&_stateVer_=logs4:104&ids=id1&ids=id2&ids=id3&wt=javabin} status=0 QTime=61"); List<SolrInputDocument> docs = readDocs(record); assertEquals(docs.size(), 1); @@ -139,8 +139,8 @@ public class PostLogsToolTest extends SolrTestCaseJ4 { public void testUpdateRecords() throws Exception { String record = sometimesSolr9Format( - "2019-12-25 20:38:23.498 INFO (qtp2103763750-126) [c:logs3 s:shard1 r:core_node2 x:logs3_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory [logs3_shard1_replica_n1] webapp=/solr path=/update params={commitWithin=1000&overwrite=true&wt=json&_=1577306114481}{deleteByQuery=*:* (-1653925534487281664)} 0 11\n" - + "2019-12-25 20:42:13.411 INFO (qtp2103763750-303) [c:logs5 s:shard1 r:core_node2 x:logs5_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory [logs5_shard1_replica_n1] webapp=/solr path=/update params={commitWithin=1000&overwrite=true&wt=json&_=1577306114481}{delete=[03bbe975-728a-4df8-aa25-fe25049dc0ef (-1653925775577972736)]} 0 1\n"); + "2019-12-25 20:38:23.498 INFO (qtp2103763750-126) [c:logs3 s:shard1 r:core_node2 x:logs3_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory [logs3_shard1_replica_n1] path=/update params={commitWithin=1000&overwrite=true&wt=json&_=1577306114481}{deleteByQuery=*:* (-1653925534487281664)} 0 11\n" + + "2019-12-25 20:42:13.411 INFO (qtp2103763750-303) [c:logs5 s:shard1 r:core_node2 x:logs5_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory [logs5_shard1_replica_n1] path=/update params={commitWithin=1000&overwrite=true&wt=json&_=1577306114481}{delete=[03bbe975-728a-4df8-aa25-fe25049dc0ef (-1653925775577972736)]} 0 1\n"); List<SolrInputDocument> docs = readDocs(record); assertEquals(docs.size(), 2); SolrInputDocument doc = docs.get(0); @@ -238,7 +238,7 @@ public class PostLogsToolTest extends SolrTestCaseJ4 { + "\tat org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:262)\n" + "\t... 44 more\n" + "\n" - + "2019-12-09 15:05:01.931 INFO (qtp2103763750-21) [c:logs4 s:shard1 r:core_node2 x:logs4_shard1_replica_n1] o.a.s.c.S.Request [logs4_shard1_replica_n1] webapp=/solr path=/select params={q=*:*&_=1575835181759&isShard=true&wt=javabin&distrib=false} hits=234868 status=0 QTime=8\n"; + + "2019-12-09 15:05:01.931 INFO (qtp2103763750-21) [c:logs4 s:shard1 r:core_node2 x:logs4_shard1_replica_n1] o.a.s.c.S.Request [logs4_shard1_replica_n1] path=/select params={q=*:*&_=1575835181759&isShard=true&wt=javabin&distrib=false} hits=234868 status=0 QTime=8\n"; List<SolrInputDocument> docs = readDocs(record); assertEquals(docs.size(), 2); SolrInputDocument doc = docs.get(0); @@ -270,7 +270,7 @@ public class PostLogsToolTest extends SolrTestCaseJ4 { @Test public void testCommit() throws Exception { String record = - "2021-10-08 16:42:10.636 INFO (qtp1080476785-26) [c:collection1 s:shard1 r:core_node2 x:collection1_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory [collection1_shard1_replica_n1] webapp=/solr path=/update params={waitSearcher=true&commit=true&softCommit=false&wt=javabin}{commit=} 0 152"; + "2021-10-08 16:42:10.636 INFO (qtp1080476785-26) [c:collection1 s:shard1 r:core_node2 x:collection1_shard1_replica_n1] o.a.s.u.p.LogUpdateProcessorFactory [collection1_shard1_replica_n1] path=/update params={waitSearcher=true&commit=true&softCommit=false&wt=javabin}{commit=} 0 152"; List<SolrInputDocument> docs = readDocs(record); assertEquals(docs.size(), 1); SolrInputDocument doc = docs.get(0); diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/config-api.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/config-api.adoc index 57799adab95..27bc358782b 100644 --- a/solr/solr-ref-guide/modules/configuration-guide/pages/config-api.adoc +++ b/solr/solr-ref-guide/modules/configuration-guide/pages/config-api.adoc @@ -442,7 +442,6 @@ And you should see the following as output: "x": "y", "rows": "10"}, "context":{ - "webapp": "/solr", "path": "/mypath", "httpMethod": "GET"}} ---- diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager-internals.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager-internals.adoc index e7aa4703e46..323aa9a3bfe 100644 --- a/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager-internals.adoc +++ b/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager-internals.adoc @@ -311,7 +311,6 @@ curl http://localhost:8983/solr/gettingstarted/test?omitHeader=true "params":{ "omitHeader":"true"}, "context":{ - "webapp":"/solr", "path":"/test", "httpMethod":"GET"}, "class":"org.apache.solr.core.RuntimeLibReqHandler", @@ -396,7 +395,6 @@ curl http://localhost:8983/solr/gettingstarted/test?omitHeader=true "omitHeader": "true" }, "context": { - "webapp": "/solr", "path": "/test", "httpMethod": "GET" }, diff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc index 3d3a23f55e1..e809b9e8d8f 100644 --- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc +++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc @@ -116,8 +116,6 @@ Solr now lets you access models encoded in ONNX format, commonly sourced from Hu The DocumentCategorizerUpdateProcessorFactorythat lets you perform sentiment and other classification tasks on fields. It is available as part of the `analysis-extras` module. - - === Deprecation removals * The `jaegertracer-configurator` module, which was deprecated in 9.2, is removed. Users should migrate to the `opentelemetry` module. @@ -185,6 +183,7 @@ Nowadays, the HTTP request is available via internal APIs: `SolrQueryRequest.get * There is no longer a distinction between trusted and untrusted configSets; all configSets are now considered trusted. To ensure security, Solr should be properly protected using authentication and authorization mechanisms, allowing only authorized users with administrative privileges to publish them. === Upgrade to Jetty 12.x + Solr upgraded to Jetty 12.x from 10.x as Jetty 10 and 11 have reached end-of-life support. Jetty 12.x requires Java 17 or newer and is fully compatible with Solr's new minimum requirement of Java 21. This upgrade brings support for modern HTTP protocols and adopts the Jakarta EE 10 namespace. For more details, see https://webtide.com/jetty-12-has-arrived/. === Open Telemetry @@ -197,6 +196,10 @@ Solr upgraded to Jetty 12.x from 10.x as Jetty 10 and 11 have reached end-of-lif The OS version of the official Docker image and provided Dockerfile has been upgraded to Ubuntu 24 (noble) from Ubuntu 22 (jammy). The Docker base image is `eclipse-temurin:25-jre-noble`. +=== Miscellaneous + +Solr logs no longer include webapp=/solr and there's no longer a "webapp" key-value pair in the internal context. + === Analysis and Tokenizers ==== PathHierarchyTokenizer Behavior Change
