lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: Add remote ip address in solr log
Date Wed, 28 Mar 2018 16:12:38 GMT
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/ 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{yyyy-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 

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.


View raw message