From httpclient-users-return-14645-archive-asf-public=cust-asf.ponee.io@hc.apache.org Mon Jan 27 16:03:17 2020 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 [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 40DAD18060E for ; Mon, 27 Jan 2020 17:03:17 +0100 (CET) Received: (qmail 12535 invoked by uid 500); 27 Jan 2020 16:03:16 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 12523 invoked by uid 99); 27 Jan 2020 16:03:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jan 2020 16:03:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 89454C030F for ; Mon, 27 Jan 2020 16:03:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.412 X-Spam-Level: X-Spam-Status: No, score=0.412 tagged_above=-999 required=6.31 tests=[DKIM_INVALID=0.1, DKIM_SIGNED=0.1, HTML_MESSAGE=0.2, KAM_DMARC_STATUS=0.01, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=neutral reason="invalid (public key: OpenSSL error: bad base64 decode)" header.d=cservenak.net Received: from mx1-ec2-va.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id YGIvVH1ZTM0V for ; Mon, 27 Jan 2020 16:03:13 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=209.85.219.193; helo=mail-yb1-f193.google.com; envelope-from=tamas@cservenak.net; receiver= Received: from mail-yb1-f193.google.com (mail-yb1-f193.google.com [209.85.219.193]) by mx1-ec2-va.apache.org (ASF Mail Server at mx1-ec2-va.apache.org) with ESMTPS id 807B2BC50F for ; Mon, 27 Jan 2020 16:03:13 +0000 (UTC) Received: by mail-yb1-f193.google.com with SMTP id w9so5145676ybs.3 for ; Mon, 27 Jan 2020 08:03:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cservenak.net; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6ndeP9tDWD9KzagmVWaJv9hbZV8aRsHZJQmCIMTBPpU=; b=LhZKQSx4eYGnDlmBZR4IRnjrHB/v7STbr+RAe4qQsoX2Pn23zl6HN6qvoPPMcOhI5c LK/2HkVTbCk7Kj3e9ZQMhZrHlL+leCwLMbmMlwbJ0UoSk5PuOLrGOgzHdQdsoPUruowW KHtvn8VVOwFTf+rR1ymbtZewP9kv4s+SXwVow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6ndeP9tDWD9KzagmVWaJv9hbZV8aRsHZJQmCIMTBPpU=; b=HslcLYjoKmue3JPuZHPpT1nRpq4cMRTRovIqA0Sd7VRBVNx+cxw7FKExau6agF50Ft 4XvPLz/6S+C8lhTJ4Z8GtgwAih7LRBD1aslQRxkEUY/5rFkDwqeA0Hj8Hf9cqBRMKguo oX6dfh2oCTTuzxyJN98Af+mQf93lv/esHXjxDZ+oOw9XWx2a5IhM4POV5dHPYorG7d4f llqHOHoUguu+J8KggNK4tRhGr1yVeGavX4KNvyu63pvRAptHwN2A+fNJmWpQFbsmp8eW FjiqQ9tbRRRNbDx47DOrDDIjJiUtANY6wE/bWum4s3sM3HhBLdd3eKajeuOkO+yheDFm inyA== X-Gm-Message-State: APjAAAWQ4tBjXkLvpwY6xR6pwcgsLx4kIrDhmmSkwnu4yD1g71wvDYMi xpxDLUKKV2GNGhOEfVbehC86gO/D5uyghg== X-Google-Smtp-Source: APXvYqwB06+/1rPoOkt7oKnICVORZrPfgeyeiTgFw61+Yn+X9Q3Y7QZSAwlpngqAVSba6cj8nyk7EA== X-Received: by 2002:a25:d4d6:: with SMTP id m205mr13493718ybf.285.1580140992718; Mon, 27 Jan 2020 08:03:12 -0800 (PST) Received: from mail-yw1-f51.google.com (mail-yw1-f51.google.com. [209.85.161.51]) by smtp.gmail.com with ESMTPSA id u185sm6737695ywf.89.2020.01.27.08.03.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jan 2020 08:03:12 -0800 (PST) Received: by mail-yw1-f51.google.com with SMTP id h126so4936203ywc.6 for ; Mon, 27 Jan 2020 08:03:11 -0800 (PST) X-Received: by 2002:a81:1289:: with SMTP id 131mr13423904yws.74.1580140991624; Mon, 27 Jan 2020 08:03:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?VGFtw6FzIENzZXJ2ZW7DoWs=?= Date: Mon, 27 Jan 2020 17:03:00 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Log any remote request made by httpClient 4.5.x To: =?UTF-8?B?VGFtw6FzIENzZXJ2ZW7DoWs=?= Cc: HttpClient User Discussion Content-Type: multipart/alternative; boundary="000000000000803d30059d213e78" --000000000000803d30059d213e78 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ...also, I wanted to log ALL requests httpclient sends.... So ended up with a LoggingRequestExecutor, something like this: https://gist.github.com/cstamas/6a4165a64348490fa4fcdaa74757c966 but it looks to me like a hack. Also, unsure how to properly collect things I need (ie. in case of proxy etc) TIA T On Mon, Jan 27, 2020 at 4:58 PM Tam=C3=A1s Cserven=C3=A1k wrote: > Oleg, > > wire is "too much" for my use case. > > I basically want an "access log"-like log, but for upstream. > so method, URL (so, full URL or at scheme + host + port + path) and > roundtrip time > (time elapsed when the response line arrived). so to say like "access log= " > but on client side. > > This log will most probably be post-processed as well (splunk, kibana) fo= r > later analysis. So, > the size (contents) and output would need to be configurable by me as wel= l. > > > TIA > T > > On Mon, Jan 27, 2020 at 4:44 PM Oleg Kalnichevski > wrote: > >> On Mon, 2020-01-27 at 14:14 +0100, Tam=C3=A1s Cserven=C3=A1k wrote: >> > Howdy, >> > >> > I'd like to log ANY remote request httpClient 4.5.x does (stable), >> > what is >> > the best way to active that? (like "upstream" request log, so method >> > + URL >> > [schema://hostname/path]). >> > >> > I'd like to cover cases even like httpClient CONNECT requests, >> > httpClient >> > retries (if configured to do so) and redirection following (if >> > configured >> > to do so). >> > >> > Any existing class or best approach? Any help appreciated. >> > >> >> Tam=C3=A1s >> >> Any particular reason for not using HttpClient context and wire >> logging? >> >> http://hc.apache.org/httpcomponents-client-4.5.x/logging.html >> >> Oleg >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org >> For additional commands, e-mail: httpclient-users-help@hc.apache.org >> >> --000000000000803d30059d213e78--