Re: Add remote ip address in solr log

2018-03-29 Thread Rick Leir
Vince
Something as simple as an Apache proxypass would help, then your Apache log 
would tell you.
Cheers -- Rick
-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 

Re: Add remote ip address in solr log

2018-03-28 Thread Vincenzo D'Amore
Thanks Shawn,

actually I have my log flooded by an old http client which generate a "bad
HTTP parsed: 400 HTTP/0.9 not supported", very likely is a nagios monitor
or a old load balancer firmware.

Anyway, I've found the ip address of the caller using the old (but still
very useful) command netstat -ntp

Thanks again and best regards,
Vincenzo


On Wed, Mar 28, 2018 at 6:12 PM, Shawn Heisey  wrote:

> On 3/28/2018 9:47 AM, Vincenzo D'Amore wrote:
>
>> I'm struggling to add http remote ip address in solr (jetty) log file.
>>
>> I've tried to modify the server/resources/log4j.properties file, which
>> seems to control the output log format, but I'm unable to understand how
>> to
>> add in ConversionPattern the proper ip address field.
>>
>> log4j.appender.file.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}
>> %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
>>
>
> I don't think this can be done in solr.log without changes to the Solr
> code.  As far as I know, there is no option you can give to log4j to log
> the IP address. Solr doesn't keep track of the IP address, so it definitely
> isn't available to the logging framework.
>
> Solr would need to *get* the remote address from the servlet container,
> probably in SolrDispatchFilter, and pass that information down the stack to
> SolrCore, where requests are actually logged.  The API is not designed to
> pass IP addresses, so a mechanism would probably have to be created.
>
> I would actually like to see this feature, so opening an enhancement issue
> in Jira is advisable.
>
> The request log in Jetty can give you this information.  In
> server/etc/jetty.xml, there is a config section already there for a request
> log, but it is commented so it's not active.
>
> Thanks,
> Shawn
>
>


-- 
Vincenzo D'Amore


Re: Add remote ip address in solr log

2018-03-28 Thread Shawn Heisey

On 3/28/2018 9:47 AM, Vincenzo D'Amore wrote:

I'm struggling to add http remote ip address in solr (jetty) log file.

I've tried to modify the server/resources/log4j.properties file, which
seems to control the output log format, but I'm unable to understand how to
add in ConversionPattern the proper ip address field.

log4j.appender.file.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}
%-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n


I don't think this can be done in solr.log without changes to the Solr 
code.  As far as I know, there is no option you can give to log4j to log 
the IP address. Solr doesn't keep track of the IP address, so it 
definitely isn't available to the logging framework.


Solr would need to *get* the remote address from the servlet container, 
probably in SolrDispatchFilter, and pass that information down the stack 
to SolrCore, where requests are actually logged.  The API is not 
designed to pass IP addresses, so a mechanism would probably have to be 
created.


I would actually like to see this feature, so opening an enhancement 
issue in Jira is advisable.


The request log in Jetty can give you this information.  In 
server/etc/jetty.xml, there is a config section already there for a 
request log, but it is commented so it's not active.


Thanks,
Shawn



Add remote ip address in solr log

2018-03-28 Thread Vincenzo D'Amore
Hi,

I'm struggling to add http remote ip address in solr (jetty) log file.

I've tried to modify the server/resources/log4j.properties file, which
seems to control the output log format, but I'm unable to understand how to
add in ConversionPattern the proper ip address field.

log4j.appender.file.layout.ConversionPattern=%d{-MM-dd HH:mm:ss.SSS}
%-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n

Many thanks,
Vincenzo


-- 
Vincenzo D'Amore