From solr-user-return-140166-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Wed Mar 28 18:12:47 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 02203180652 for ; Wed, 28 Mar 2018 18:12:46 +0200 (CEST) Received: (qmail 56117 invoked by uid 500); 28 Mar 2018 16:12:44 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 56040 invoked by uid 99); 28 Mar 2018 16:12:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2018 16:12:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 7612AC0CD6 for ; Wed, 28 Mar 2018 16:12:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.112 X-Spam-Level: X-Spam-Status: No, score=-0.112 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=elyograg.org Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id gNFUL2vk2LlV for ; Wed, 28 Mar 2018 16:12:41 +0000 (UTC) Received: from frodo.elyograg.org (frodo.elyograg.org [166.70.79.217]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D96165F5AF for ; Wed, 28 Mar 2018 16:12:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by frodo.elyograg.org (Postfix) with ESMTP id 9A70F8AB for ; Wed, 28 Mar 2018 10:12:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=elyograg.org; h= content-language:content-transfer-encoding:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:subject:subject:received :received; s=mail; t=1522253554; bh=hk+YtzRj9Su7oYnyTjagJS6doCbI kgD5681KQwNefnU=; b=GQqrkdmFXz/KmS1Qt0nprzm/Gdhk7eXE7lQVquctiJ2l 7ZGGiKoambCy9QiVdtjSPIaVK3eQp/xHilzR9IpaMEdJotY+PY8mY7s+0/co8hhA zAUjgm4ldvqwyGEnUo94K+SgGPdTa0xAsBz4lwOc2v7Sr/vAUmT4GYMHWHSltG8= X-Virus-Scanned: Debian amavisd-new at frodo.elyograg.org Received: from frodo.elyograg.org ([127.0.0.1]) by localhost (frodo.elyograg.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ahIwe7PDPScg for ; Wed, 28 Mar 2018 10:12:34 -0600 (MDT) Received: from [192.168.1.127] (127.int.elyograg.org [192.168.1.127]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: elyograg@elyograg.org) by frodo.elyograg.org (Postfix) with ESMTPSA id 30BEF8A6 for ; Wed, 28 Mar 2018 10:12:34 -0600 (MDT) Subject: Re: Add remote ip address in solr log To: solr-user@lucene.apache.org References: From: Shawn Heisey Message-ID: <6689b3ed-810d-1eff-a9a6-f70f41e73471@elyograg.org> Date: Wed, 28 Mar 2018 10:12:38 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US 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{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 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