<p>I have one question regarding the <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage" rel="nofollow noreferrer">access log of envoy</a>:</p>
<ul>
<li>I use the field host: <code>%REQ(:AUTHORITY)%</code>, can I remove the port?</li>
</ul>
<p>Or is there another fields which include the <code>AUTHORITY</code> and doesn't include the port?</p>

JME
<p>First, the <code>&quot;%REQ(:AUTHORITY)%&quot;</code> field does not contain any information about the port. Look at this <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-strings" rel="nofollow noreferrer">official documentation</a>:</p>
<blockquote>
<p>Format strings are plain strings, specified using the  <code>format</code>  key. They may contain either command operators or other characters interpreted as a plain string. The access log formatter does not make any assumptions about a new line separator, so one has to specified as part of the format string. See the  <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-default-format" rel="nofollow noreferrer">default format</a>  for an example.</p>
</blockquote>
<blockquote>
<p>If custom format string is not specified, Envoy uses the following default format:</p>
</blockquote>
<pre><code>[%START_TIME%] &quot;%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%&quot;
%RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION%
%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% &quot;%REQ(X-FORWARDED-FOR)%&quot; &quot;%REQ(USER-AGENT)%&quot;
&quot;%REQ(X-REQUEST-ID)%&quot; &quot;%REQ(:AUTHORITY)%&quot; &quot;%UPSTREAM_HOST%&quot;\n
</code></pre>
<blockquote>
<p>Example of the default Envoy access log format:</p>
</blockquote>
<pre><code>[2016-04-15T20:17:00.310Z] &quot;POST /api/v1/locations HTTP/2&quot; 204 - 154 0 226 100 &quot;10.0.35.28&quot;
&quot;nsq2http&quot; &quot;cc21d9b0-cf5c-432b-8c7e-98aeb7988cd2&quot; &quot;locations&quot; &quot;tcp://10.0.2.1:80&quot;
</code></pre>
<p>Field <code>&quot;%REQ(:AUTHORITY)%&quot;</code> shows  value <code>&quot;locations&quot;</code> and field <code>&quot;%UPSTREAM_HOST%&quot;</code> shows <code>&quot;tcp://10.0.2.1:80&quot;</code>.</p>
<p>You can customise your log format based on format keys.</p>
<p><a href="https://blog.getambassador.io/understanding-envoy-proxy-and-ambassador-http-access-logs-fee7802a2ec5" rel="nofollow noreferrer">Here</a> you can find good article about understanding these logs. Field <code>&quot;%REQ(:AUTHORITY)%&quot;</code> is value of the <code>Host</code> (HTTP/1.1) or <code>Authority</code> (HTTP/2) header. Look at <a href="https://twitter.com/askmeegs/status/1157029140693995521/photo/1" rel="nofollow noreferrer">this picture</a> to better understand.</p>
<p>I suppose you want to edit the field <code>&quot;%UPSTREAM_HOST%&quot;</code> It is impossible to remove the port from this field. You can find documentation with description of these fields <a href="https://www.bookstack.cn/read/envoyproxy-1.14/c5ab90d69db4830d.md" rel="nofollow noreferrer">here</a>:</p>
<blockquote>
<p>%UPSTREAM_HOST%</p>
<p>Upstream host URL (e.g.,  <a href="https://www.envoyproxy.io/docs/envoy/v1.14.0/configuration/observability/tcp:/ip:port" rel="nofollow noreferrer">tcp://ip:port</a>  for TCP connections).</p>
</blockquote>
<p>I haven't found any other field that returns just an IP address without a port.</p>
<hr />
<p><strong>Answering your question:</strong></p>
<blockquote>
<ul>
<li>I use the field host:  <code>%REQ(:AUTHORITY)%</code>  , can I remove the port ?</li>
</ul>
</blockquote>
<p>No, because this field does not return a port at all.</p>
<blockquote>
<p>is there another fields which include the AUTHORITY and doesnt include the port?</p>
</blockquote>
<p>You can use <code>%REQ(:AUTHORITY)%</code> field without <code>&quot;%UPSTREAM_HOST%&quot;</code> field. You can do this by creating your custom log format. As far as I know it is impossible to have only IP adress without port in the logs.</p>
