<p>How to modify istio meshconfig access log format when the output accessLogEncoding set to JSON, changing the format as <a href="https://istio.io/latest/docs/tasks/observability/logs/access-log/" rel="nofollow noreferrer">describe on the docs</a> didn't work.</p>
<pre><code>spec:
  meshConfig:
    accessLogFile: /dev/stdout
    accessLogEncoding: JSON
    accessLogFormat: '[%START_TIME%] \&quot;%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\&quot; %RESPONSE_CODE% %RESPONSE_FLAGS% %RESPONSE_CODE_DETAILS% %CONNECTION_TERMINATION_DETAILS%\&quot;%UPSTREAM_TRANSPORT_FAILURE_REASON%\&quot; %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; %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SER'
</code></pre>

<p>It works!, This is what i needed:</p>
<pre><code>spec:
  meshConfig:
    accessLogFile: /dev/stdout
    accessLogEncoding: JSON
    accessLogFormat: |
      {
        &quot;protocol&quot;: &quot;%PROTOCOL%&quot;,
        &quot;upstream_service_time&quot;: &quot;%REQ(x-envoy-upstream-service-time)%&quot;,
        &quot;upstream_local_address&quot;: &quot;%UPSTREAM_LOCAL_ADDRESS%&quot;,
        &quot;duration&quot;: &quot;%DURATION%&quot;,
        &quot;upstream_transport_failure_reason&quot;: &quot;%UPSTREAM_TRANSPORT_FAILURE_REASON%&quot;,
        &quot;route_name&quot;: &quot;%ROUTE_NAME%&quot;,
        &quot;downstream_local_address&quot;: &quot;%DOWNSTREAM_LOCAL_ADDRESS%&quot;,
        &quot;user_agent&quot;: &quot;%REQ(USER-AGENT)%&quot;,
        &quot;response_code&quot;: &quot;%RESPONSE_CODE%&quot;,
        &quot;response_flags&quot;: &quot;%RESPONSE_FLAGS%&quot;,
        &quot;start_time&quot;: &quot;%START_TIME%&quot;,
        &quot;method&quot;: &quot;%REQ(:METHOD)%&quot;,
        &quot;request_id&quot;: &quot;%REQ(X-REQUEST-ID)%&quot;,
        &quot;upstream_host&quot;: &quot;%UPSTREAM_HOST%&quot;,
        &quot;x_forwarded_for&quot;: &quot;%REQ(X-FORWARDED-FOR)%&quot;,
        &quot;client_ip&quot;: &quot;%REQ(True-Client-Ip)%&quot;,
        &quot;requested_server_name&quot;: &quot;%REQUESTED_SERVER_NAME%&quot;,
        &quot;bytes_received&quot;: &quot;%BYTES_RECEIVED%&quot;,
        &quot;bytes_sent&quot;: &quot;%BYTES_SENT%&quot;,
        &quot;upstream_cluster&quot;: &quot;%UPSTREAM_CLUSTER%&quot;,
        &quot;downstream_remote_address&quot;: &quot;%DOWNSTREAM_REMOTE_ADDRESS%&quot;,
        &quot;authority&quot;: &quot;%REQ(:AUTHORITY)%&quot;,
        &quot;path&quot;: &quot;%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%&quot;,
        &quot;response_code_details&quot;: &quot;%RESPONSE_CODE_DETAILS%&quot;
      }
</code></pre>
