You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Andrew Hankinson <an...@rism.digital> on 2025/06/23 07:06:14 UTC

Logging POST parameters

Hello,

I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a number of slow queries.

We've implemented almost all of our searches using the JSON Request API, https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html

However, in the logs, and in the slow query logs, the JSON Request API search parameters do not appear:

2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s: r: x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr path=/select params={} hits=0 status=0 QTime=16914

You can imagine this makes it difficult to tell what is causing the problem!

I've looked around and couldn't really find anything. I'm hesitant to use the "logParamsList" query parameter since I would have to 'opt-in' to quite a big list of query parameters. I've also tried enabling the "temporary" logging, but I think there's a bug with enabling these in standalone mode? I get an error "Parameter nodes only supported in Cloud mode". 

Is there a secret incantation that would help here?

Thanks,
-Andrew

Re: Logging POST parameters

Posted by Andrew Hankinson <an...@rism.digital>.
I think it only looks at the GET parameters, though. With the JSON Request API, the parameters are sent in the body of the request, and I can't see any code in the links that you sent that looks at the body of the request for the search parameters.

> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
> 
> Hi,
> It seems like it works by design. see
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
> It logs only query string params if logParamsList is absent, and
> perhaps you'll get all json request logged if set logParamsList=json see
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
> but I'm not sure whether it works as you need.
> 
> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
> <an...@rism.digital> wrote:
> 
>> Hello,
>> 
>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a number of
>> slow queries.
>> 
>> We've implemented almost all of our searches using the JSON Request API,
>> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
>> 
>> However, in the logs, and in the slow query logs, the JSON Request API
>> search parameters do not appear:
>> 
>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s: r:
>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
>> path=/select params={} hits=0 status=0 QTime=16914
>> 
>> You can imagine this makes it difficult to tell what is causing the
>> problem!
>> 
>> I've looked around and couldn't really find anything. I'm hesitant to use
>> the "logParamsList" query parameter since I would have to 'opt-in' to quite
>> a big list of query parameters. I've also tried enabling the "temporary"
>> logging, but I think there's a bug with enabling these in standalone mode?
>> I get an error "Parameter nodes only supported in Cloud mode".
>> 
>> Is there a secret incantation that would help here?
>> 
>> Thanks,
>> -Andrew
> 
> 
> 
> -- 
> Sincerely yours
> Mikhail Khludnev


Re: Logging POST parameters

Posted by Andrew Hankinson <an...@rism.digital>.
I think I would expect the same number of parameters to be there as if I were using the “old” GET method? 

> On 24 Jun 2025, at 08:48, Mikhail Khludnev <mk...@apache.org> wrote:
> 
> Andrew, here are two thoughts?
> What if you add an arbitrary request param like foo=user_input_or_req_id, I
> expect that it will be logged in slow log. May you achieve your need via
> this trick?
> Regarding SOLR-17794 <https://issues.apache.org/jira/browse/SOLR-17794>, do
> you expect a whole payload will be logged into slow log? I'm afraid it
> might be too large for such logging, WDYT?
> 
>> On Mon, Jun 23, 2025 at 5:03 PM Andrew Hankinson
>> <an...@rism.digital> wrote:
>> 
>> Done, thank you.
>> 
>> https://issues.apache.org/jira/browse/SOLR-17794
>> 
>> -Andrew
>> 
>>>> On 23 Jun 2025, at 14:42, Mikhail Khludnev <mk...@apache.org> wrote:
>>> 
>>> In that phrase I invited you to contribute the code, which fits in the
>>> generic usecase. But, ok you can start with a JIRA ticket, it seems like
>>> the lack of functionality.
>>> Meanwhile, the particular case might be fixed quickly (and dirty) with a
>>> custom few-lines component.
>>> 
>>> On Mon, Jun 23, 2025 at 2:24 PM Andrew Hankinson
>>> <an...@rism.digital> wrote:
>>> 
>>>> My Java knowledge is limited to read-only, but could you tell me more
>>>> about what you mean by "a contribution for common cases is welcomed!"?
>>>> 
>>>> I'm happy to write docs or a use case or a JIRA ticket if that is
>>>> worthwhile?
>>>> 
>>>>> On 23 Jun 2025, at 12:41, Mikhail Khludnev <mk...@apache.org> wrote:
>>>>> 
>>>>> Turns out that params are loaded into req.toLog here [1] that's
>> happened
>>>>> before stream body is parsed and json is inserted as json param at [2]
>>>>> As a quick custom fix you may develop a component which will put
>>>>> req.params.json into req.toLog.
>>>>> 
>>>>> Also, a contribution for common cases is welcomed!
>>>>> 
>>>>> [1]
>>>>> 
>>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2916
>>>>> [2]
>>>>> 
>>>> 
>> https://github.com/apache/solr/blob/b76a29d17c874806e3b6516810772e2238e93098/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L235
>>>>> 
>>>>> On Mon, Jun 23, 2025 at 11:32 AM Andrew Hankinson
>>>>> <an...@rism.digital> wrote:
>>>>> 
>>>>>> Sorry -- I also meant to mention that I set `logParamsList=json` but
>>>> that
>>>>>> didn't work because I think it's looking for a "&json=... GET
>> parameter.
>>>>>> 
>>>>>>> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
>>>>>>> 
>>>>>>> Hi,
>>>>>>> It seems like it works by design. see
>>>>>>> 
>>>>>> 
>>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
>>>>>>> It logs only query string params if logParamsList is absent, and
>>>>>>> perhaps you'll get all json request logged if set logParamsList=json
>>>> see
>>>>>>> 
>>>>>> 
>>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
>>>>>>> but I'm not sure whether it works as you need.
>>>>>>> 
>>>>>>> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
>>>>>>> <an...@rism.digital> wrote:
>>>>>>> 
>>>>>>>> Hello,
>>>>>>>> 
>>>>>>>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a
>>>> number
>>>>>> of
>>>>>>>> slow queries.
>>>>>>>> 
>>>>>>>> We've implemented almost all of our searches using the JSON Request
>>>> API,
>>>>>>>> 
>>>>>> 
>>>> 
>> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
>>>>>>>> 
>>>>>>>> However, in the logs, and in the slow query logs, the JSON Request
>> API
>>>>>>>> search parameters do not appear:
>>>>>>>> 
>>>>>>>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s:
>>>> r:
>>>>>>>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
>>>>>>>> path=/select params={} hits=0 status=0 QTime=16914
>>>>>>>> 
>>>>>>>> You can imagine this makes it difficult to tell what is causing the
>>>>>>>> problem!
>>>>>>>> 
>>>>>>>> I've looked around and couldn't really find anything. I'm hesitant
>> to
>>>>>> use
>>>>>>>> the "logParamsList" query parameter since I would have to 'opt-in'
>> to
>>>>>> quite
>>>>>>>> a big list of query parameters. I've also tried enabling the
>>>> "temporary"
>>>>>>>> logging, but I think there's a bug with enabling these in standalone
>>>>>> mode?
>>>>>>>> I get an error "Parameter nodes only supported in Cloud mode".
>>>>>>>> 
>>>>>>>> Is there a secret incantation that would help here?
>>>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> -Andrew
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> Sincerely yours
>>>>>>> Mikhail Khludnev
>>>>>> 
>>>>>> 
>>>>> 
>>>>> --
>>>>> Sincerely yours
>>>>> Mikhail Khludnev
>>>> 
>>>> 
>>> 
>>> --
>>> Sincerely yours
>>> Mikhail Khludnev
>> 
>> 
> 
> --
> Sincerely yours
> Mikhail Khludnev

Re: Logging POST parameters

Posted by Mikhail Khludnev <mk...@apache.org>.
Andrew, here are two thoughts?
What if you add an arbitrary request param like foo=user_input_or_req_id, I
expect that it will be logged in slow log. May you achieve your need via
this trick?
Regarding SOLR-17794 <https://issues.apache.org/jira/browse/SOLR-17794>, do
you expect a whole payload will be logged into slow log? I'm afraid it
might be too large for such logging, WDYT?

On Mon, Jun 23, 2025 at 5:03 PM Andrew Hankinson
<an...@rism.digital> wrote:

> Done, thank you.
>
> https://issues.apache.org/jira/browse/SOLR-17794
>
> -Andrew
>
> > On 23 Jun 2025, at 14:42, Mikhail Khludnev <mk...@apache.org> wrote:
> >
> > In that phrase I invited you to contribute the code, which fits in the
> > generic usecase. But, ok you can start with a JIRA ticket, it seems like
> > the lack of functionality.
> > Meanwhile, the particular case might be fixed quickly (and dirty) with a
> > custom few-lines component.
> >
> > On Mon, Jun 23, 2025 at 2:24 PM Andrew Hankinson
> > <an...@rism.digital> wrote:
> >
> >> My Java knowledge is limited to read-only, but could you tell me more
> >> about what you mean by "a contribution for common cases is welcomed!"?
> >>
> >> I'm happy to write docs or a use case or a JIRA ticket if that is
> >> worthwhile?
> >>
> >>> On 23 Jun 2025, at 12:41, Mikhail Khludnev <mk...@apache.org> wrote:
> >>>
> >>> Turns out that params are loaded into req.toLog here [1] that's
> happened
> >>> before stream body is parsed and json is inserted as json param at [2]
> >>> As a quick custom fix you may develop a component which will put
> >>> req.params.json into req.toLog.
> >>>
> >>> Also, a contribution for common cases is welcomed!
> >>>
> >>> [1]
> >>>
> >>
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2916
> >>> [2]
> >>>
> >>
> https://github.com/apache/solr/blob/b76a29d17c874806e3b6516810772e2238e93098/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L235
> >>>
> >>> On Mon, Jun 23, 2025 at 11:32 AM Andrew Hankinson
> >>> <an...@rism.digital> wrote:
> >>>
> >>>> Sorry -- I also meant to mention that I set `logParamsList=json` but
> >> that
> >>>> didn't work because I think it's looking for a "&json=... GET
> parameter.
> >>>>
> >>>>> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
> >>>>>
> >>>>> Hi,
> >>>>> It seems like it works by design. see
> >>>>>
> >>>>
> >>
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
> >>>>> It logs only query string params if logParamsList is absent, and
> >>>>> perhaps you'll get all json request logged if set logParamsList=json
> >> see
> >>>>>
> >>>>
> >>
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
> >>>>> but I'm not sure whether it works as you need.
> >>>>>
> >>>>> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
> >>>>> <an...@rism.digital> wrote:
> >>>>>
> >>>>>> Hello,
> >>>>>>
> >>>>>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a
> >> number
> >>>> of
> >>>>>> slow queries.
> >>>>>>
> >>>>>> We've implemented almost all of our searches using the JSON Request
> >> API,
> >>>>>>
> >>>>
> >>
> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
> >>>>>>
> >>>>>> However, in the logs, and in the slow query logs, the JSON Request
> API
> >>>>>> search parameters do not appear:
> >>>>>>
> >>>>>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s:
> >> r:
> >>>>>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
> >>>>>> path=/select params={} hits=0 status=0 QTime=16914
> >>>>>>
> >>>>>> You can imagine this makes it difficult to tell what is causing the
> >>>>>> problem!
> >>>>>>
> >>>>>> I've looked around and couldn't really find anything. I'm hesitant
> to
> >>>> use
> >>>>>> the "logParamsList" query parameter since I would have to 'opt-in'
> to
> >>>> quite
> >>>>>> a big list of query parameters. I've also tried enabling the
> >> "temporary"
> >>>>>> logging, but I think there's a bug with enabling these in standalone
> >>>> mode?
> >>>>>> I get an error "Parameter nodes only supported in Cloud mode".
> >>>>>>
> >>>>>> Is there a secret incantation that would help here?
> >>>>>>
> >>>>>> Thanks,
> >>>>>> -Andrew
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Sincerely yours
> >>>>> Mikhail Khludnev
> >>>>
> >>>>
> >>>
> >>> --
> >>> Sincerely yours
> >>> Mikhail Khludnev
> >>
> >>
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
>
>

-- 
Sincerely yours
Mikhail Khludnev

Re: Logging POST parameters

Posted by Andrew Hankinson <an...@rism.digital>.
Done, thank you.

https://issues.apache.org/jira/browse/SOLR-17794

-Andrew

> On 23 Jun 2025, at 14:42, Mikhail Khludnev <mk...@apache.org> wrote:
> 
> In that phrase I invited you to contribute the code, which fits in the
> generic usecase. But, ok you can start with a JIRA ticket, it seems like
> the lack of functionality.
> Meanwhile, the particular case might be fixed quickly (and dirty) with a
> custom few-lines component.
> 
> On Mon, Jun 23, 2025 at 2:24 PM Andrew Hankinson
> <an...@rism.digital> wrote:
> 
>> My Java knowledge is limited to read-only, but could you tell me more
>> about what you mean by "a contribution for common cases is welcomed!"?
>> 
>> I'm happy to write docs or a use case or a JIRA ticket if that is
>> worthwhile?
>> 
>>> On 23 Jun 2025, at 12:41, Mikhail Khludnev <mk...@apache.org> wrote:
>>> 
>>> Turns out that params are loaded into req.toLog here [1] that's happened
>>> before stream body is parsed and json is inserted as json param at [2]
>>> As a quick custom fix you may develop a component which will put
>>> req.params.json into req.toLog.
>>> 
>>> Also, a contribution for common cases is welcomed!
>>> 
>>> [1]
>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2916
>>> [2]
>>> 
>> https://github.com/apache/solr/blob/b76a29d17c874806e3b6516810772e2238e93098/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L235
>>> 
>>> On Mon, Jun 23, 2025 at 11:32 AM Andrew Hankinson
>>> <an...@rism.digital> wrote:
>>> 
>>>> Sorry -- I also meant to mention that I set `logParamsList=json` but
>> that
>>>> didn't work because I think it's looking for a "&json=... GET parameter.
>>>> 
>>>>> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
>>>>> 
>>>>> Hi,
>>>>> It seems like it works by design. see
>>>>> 
>>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
>>>>> It logs only query string params if logParamsList is absent, and
>>>>> perhaps you'll get all json request logged if set logParamsList=json
>> see
>>>>> 
>>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
>>>>> but I'm not sure whether it works as you need.
>>>>> 
>>>>> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
>>>>> <an...@rism.digital> wrote:
>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a
>> number
>>>> of
>>>>>> slow queries.
>>>>>> 
>>>>>> We've implemented almost all of our searches using the JSON Request
>> API,
>>>>>> 
>>>> 
>> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
>>>>>> 
>>>>>> However, in the logs, and in the slow query logs, the JSON Request API
>>>>>> search parameters do not appear:
>>>>>> 
>>>>>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s:
>> r:
>>>>>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
>>>>>> path=/select params={} hits=0 status=0 QTime=16914
>>>>>> 
>>>>>> You can imagine this makes it difficult to tell what is causing the
>>>>>> problem!
>>>>>> 
>>>>>> I've looked around and couldn't really find anything. I'm hesitant to
>>>> use
>>>>>> the "logParamsList" query parameter since I would have to 'opt-in' to
>>>> quite
>>>>>> a big list of query parameters. I've also tried enabling the
>> "temporary"
>>>>>> logging, but I think there's a bug with enabling these in standalone
>>>> mode?
>>>>>> I get an error "Parameter nodes only supported in Cloud mode".
>>>>>> 
>>>>>> Is there a secret incantation that would help here?
>>>>>> 
>>>>>> Thanks,
>>>>>> -Andrew
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Sincerely yours
>>>>> Mikhail Khludnev
>>>> 
>>>> 
>>> 
>>> --
>>> Sincerely yours
>>> Mikhail Khludnev
>> 
>> 
> 
> -- 
> Sincerely yours
> Mikhail Khludnev


Re: Logging POST parameters

Posted by Mikhail Khludnev <mk...@apache.org>.
In that phrase I invited you to contribute the code, which fits in the
generic usecase. But, ok you can start with a JIRA ticket, it seems like
the lack of functionality.
Meanwhile, the particular case might be fixed quickly (and dirty) with a
custom few-lines component.

On Mon, Jun 23, 2025 at 2:24 PM Andrew Hankinson
<an...@rism.digital> wrote:

> My Java knowledge is limited to read-only, but could you tell me more
> about what you mean by "a contribution for common cases is welcomed!"?
>
> I'm happy to write docs or a use case or a JIRA ticket if that is
> worthwhile?
>
> > On 23 Jun 2025, at 12:41, Mikhail Khludnev <mk...@apache.org> wrote:
> >
> > Turns out that params are loaded into req.toLog here [1] that's happened
> > before stream body is parsed and json is inserted as json param at [2]
> > As a quick custom fix you may develop a component which will put
> > req.params.json into req.toLog.
> >
> > Also, a contribution for common cases is welcomed!
> >
> > [1]
> >
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2916
> > [2]
> >
> https://github.com/apache/solr/blob/b76a29d17c874806e3b6516810772e2238e93098/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L235
> >
> > On Mon, Jun 23, 2025 at 11:32 AM Andrew Hankinson
> > <an...@rism.digital> wrote:
> >
> >> Sorry -- I also meant to mention that I set `logParamsList=json` but
> that
> >> didn't work because I think it's looking for a "&json=... GET parameter.
> >>
> >>> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
> >>>
> >>> Hi,
> >>> It seems like it works by design. see
> >>>
> >>
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
> >>> It logs only query string params if logParamsList is absent, and
> >>> perhaps you'll get all json request logged if set logParamsList=json
> see
> >>>
> >>
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
> >>> but I'm not sure whether it works as you need.
> >>>
> >>> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
> >>> <an...@rism.digital> wrote:
> >>>
> >>>> Hello,
> >>>>
> >>>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a
> number
> >> of
> >>>> slow queries.
> >>>>
> >>>> We've implemented almost all of our searches using the JSON Request
> API,
> >>>>
> >>
> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
> >>>>
> >>>> However, in the logs, and in the slow query logs, the JSON Request API
> >>>> search parameters do not appear:
> >>>>
> >>>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s:
> r:
> >>>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
> >>>> path=/select params={} hits=0 status=0 QTime=16914
> >>>>
> >>>> You can imagine this makes it difficult to tell what is causing the
> >>>> problem!
> >>>>
> >>>> I've looked around and couldn't really find anything. I'm hesitant to
> >> use
> >>>> the "logParamsList" query parameter since I would have to 'opt-in' to
> >> quite
> >>>> a big list of query parameters. I've also tried enabling the
> "temporary"
> >>>> logging, but I think there's a bug with enabling these in standalone
> >> mode?
> >>>> I get an error "Parameter nodes only supported in Cloud mode".
> >>>>
> >>>> Is there a secret incantation that would help here?
> >>>>
> >>>> Thanks,
> >>>> -Andrew
> >>>
> >>>
> >>>
> >>> --
> >>> Sincerely yours
> >>> Mikhail Khludnev
> >>
> >>
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
>
>

-- 
Sincerely yours
Mikhail Khludnev

Re: Logging POST parameters

Posted by Andrew Hankinson <an...@rism.digital>.
My Java knowledge is limited to read-only, but could you tell me more about what you mean by "a contribution for common cases is welcomed!"? 

I'm happy to write docs or a use case or a JIRA ticket if that is worthwhile?

> On 23 Jun 2025, at 12:41, Mikhail Khludnev <mk...@apache.org> wrote:
> 
> Turns out that params are loaded into req.toLog here [1] that's happened
> before stream body is parsed and json is inserted as json param at [2]
> As a quick custom fix you may develop a component which will put
> req.params.json into req.toLog.
> 
> Also, a contribution for common cases is welcomed!
> 
> [1]
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2916
> [2]
> https://github.com/apache/solr/blob/b76a29d17c874806e3b6516810772e2238e93098/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L235
> 
> On Mon, Jun 23, 2025 at 11:32 AM Andrew Hankinson
> <an...@rism.digital> wrote:
> 
>> Sorry -- I also meant to mention that I set `logParamsList=json` but that
>> didn't work because I think it's looking for a "&json=... GET parameter.
>> 
>>> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
>>> 
>>> Hi,
>>> It seems like it works by design. see
>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
>>> It logs only query string params if logParamsList is absent, and
>>> perhaps you'll get all json request logged if set logParamsList=json see
>>> 
>> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
>>> but I'm not sure whether it works as you need.
>>> 
>>> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
>>> <an...@rism.digital> wrote:
>>> 
>>>> Hello,
>>>> 
>>>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a number
>> of
>>>> slow queries.
>>>> 
>>>> We've implemented almost all of our searches using the JSON Request API,
>>>> 
>> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
>>>> 
>>>> However, in the logs, and in the slow query logs, the JSON Request API
>>>> search parameters do not appear:
>>>> 
>>>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s: r:
>>>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
>>>> path=/select params={} hits=0 status=0 QTime=16914
>>>> 
>>>> You can imagine this makes it difficult to tell what is causing the
>>>> problem!
>>>> 
>>>> I've looked around and couldn't really find anything. I'm hesitant to
>> use
>>>> the "logParamsList" query parameter since I would have to 'opt-in' to
>> quite
>>>> a big list of query parameters. I've also tried enabling the "temporary"
>>>> logging, but I think there's a bug with enabling these in standalone
>> mode?
>>>> I get an error "Parameter nodes only supported in Cloud mode".
>>>> 
>>>> Is there a secret incantation that would help here?
>>>> 
>>>> Thanks,
>>>> -Andrew
>>> 
>>> 
>>> 
>>> --
>>> Sincerely yours
>>> Mikhail Khludnev
>> 
>> 
> 
> -- 
> Sincerely yours
> Mikhail Khludnev


Re: Logging POST parameters

Posted by Mikhail Khludnev <mk...@apache.org>.
Turns out that params are loaded into req.toLog here [1] that's happened
before stream body is parsed and json is inserted as json param at [2]
As a quick custom fix you may develop a component which will put
req.params.json into req.toLog.

Also, a contribution for common cases is welcomed!

[1]
https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2916
[2]
https://github.com/apache/solr/blob/b76a29d17c874806e3b6516810772e2238e93098/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java#L235

On Mon, Jun 23, 2025 at 11:32 AM Andrew Hankinson
<an...@rism.digital> wrote:

> Sorry -- I also meant to mention that I set `logParamsList=json` but that
> didn't work because I think it's looking for a "&json=... GET parameter.
>
> > On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
> >
> > Hi,
> > It seems like it works by design. see
> >
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
> > It logs only query string params if logParamsList is absent, and
> > perhaps you'll get all json request logged if set logParamsList=json see
> >
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
> > but I'm not sure whether it works as you need.
> >
> > On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
> > <an...@rism.digital> wrote:
> >
> >> Hello,
> >>
> >> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a number
> of
> >> slow queries.
> >>
> >> We've implemented almost all of our searches using the JSON Request API,
> >>
> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
> >>
> >> However, in the logs, and in the slow query logs, the JSON Request API
> >> search parameters do not appear:
> >>
> >> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s: r:
> >> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
> >> path=/select params={} hits=0 status=0 QTime=16914
> >>
> >> You can imagine this makes it difficult to tell what is causing the
> >> problem!
> >>
> >> I've looked around and couldn't really find anything. I'm hesitant to
> use
> >> the "logParamsList" query parameter since I would have to 'opt-in' to
> quite
> >> a big list of query parameters. I've also tried enabling the "temporary"
> >> logging, but I think there's a bug with enabling these in standalone
> mode?
> >> I get an error "Parameter nodes only supported in Cloud mode".
> >>
> >> Is there a secret incantation that would help here?
> >>
> >> Thanks,
> >> -Andrew
> >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
>
>

-- 
Sincerely yours
Mikhail Khludnev

Re: Logging POST parameters

Posted by Andrew Hankinson <an...@rism.digital>.
Sorry -- I also meant to mention that I set `logParamsList=json` but that didn't work because I think it's looking for a "&json=... GET parameter.

> On 23 Jun 2025, at 10:14, Mikhail Khludnev <mk...@apache.org> wrote:
> 
> Hi,
> It seems like it works by design. see
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
> It logs only query string params if logParamsList is absent, and
> perhaps you'll get all json request logged if set logParamsList=json see
> https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
> but I'm not sure whether it works as you need.
> 
> On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
> <an...@rism.digital> wrote:
> 
>> Hello,
>> 
>> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a number of
>> slow queries.
>> 
>> We've implemented almost all of our searches using the JSON Request API,
>> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
>> 
>> However, in the logs, and in the slow query logs, the JSON Request API
>> search parameters do not appear:
>> 
>> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s: r:
>> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
>> path=/select params={} hits=0 status=0 QTime=16914
>> 
>> You can imagine this makes it difficult to tell what is causing the
>> problem!
>> 
>> I've looked around and couldn't really find anything. I'm hesitant to use
>> the "logParamsList" query parameter since I would have to 'opt-in' to quite
>> a big list of query parameters. I've also tried enabling the "temporary"
>> logging, but I think there's a bug with enabling these in standalone mode?
>> I get an error "Parameter nodes only supported in Cloud mode".
>> 
>> Is there a secret incantation that would help here?
>> 
>> Thanks,
>> -Andrew
> 
> 
> 
> -- 
> Sincerely yours
> Mikhail Khludnev


Re: Logging POST parameters

Posted by Mikhail Khludnev <mk...@apache.org>.
Hi,
It seems like it works by design. see
https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/core/SolrCore.java#L2932
It logs only query string params if logParamsList is absent, and
perhaps you'll get all json request logged if set logParamsList=json see
https://github.com/apache/solr/blob/e17078a98a8ebea1a28853d02527f4dc81da4d6b/solr/core/src/java/org/apache/solr/request/json/RequestUtil.java#L182
but I'm not sure whether it works as you need.

On Mon, Jun 23, 2025 at 10:07 AM Andrew Hankinson
<an...@rism.digital> wrote:

> Hello,
>
> I am on Solr 9.8.1 in standalone mode, and I'm trying to debug a number of
> slow queries.
>
> We've implemented almost all of our searches using the JSON Request API,
> https://solr.apache.org/guide/solr/latest/query-guide/json-request-api.html
>
> However, in the logs, and in the slow query logs, the JSON Request API
> search parameters do not appear:
>
> 2025-06-23 06:40:36.284 WARN  (qtp1844334363-624-null-177821) [c: s: r:
> x:core_name t:null-177821] o.a.s.c.S.SlowRequest slow: webapp=/solr
> path=/select params={} hits=0 status=0 QTime=16914
>
> You can imagine this makes it difficult to tell what is causing the
> problem!
>
> I've looked around and couldn't really find anything. I'm hesitant to use
> the "logParamsList" query parameter since I would have to 'opt-in' to quite
> a big list of query parameters. I've also tried enabling the "temporary"
> logging, but I think there's a bug with enabling these in standalone mode?
> I get an error "Parameter nodes only supported in Cloud mode".
>
> Is there a secret incantation that would help here?
>
> Thanks,
> -Andrew



-- 
Sincerely yours
Mikhail Khludnev