ELB for Envoy のアプリケーションログを確認してみた

ELB for Envoy のアプリケーションログを確認してみた

Elastic Load Balancing for Envoy のプロセスのログ(application log)について、ログレベルごとの出力、コンポーネント別のレベル、1行に含まれるログ項目、text と JSON の書式を確認しました。
2026.11.27

はじめに

2026年11月25日に、Elastic Load Balancing for Envoy の一般提供が発表されました。

https://aws.amazon.com/about-aws/whats-new/2026/11/elastic-load-balancing-for-envoy-generally-available/

先行記事で、ELB for Envoy のリバースプロキシとしての動作やアクセスログについて紹介しています。

https://dev.classmethod.jp/articles/aws-elb-for-envoy-ga-create-proxy/

https://dev.classmethod.jp/articles/elb-for-envoy-access-log-cloudwatch-logs/

ELB for Envoy のプロキシは、アクセスログとは別に、Envoy プロセス自身のログ(ドキュメントでは application log)を CloudWatch Logs へ出力します。この記事では、このプロセスのログについて、ログレベルごとの出力、コンポーネント別のレベル、1行に含まれる項目と書式を確認した結果を紹介します。

検証環境

  • リージョン:東京(ap-northeast-1)
  • プロキシのバージョン:1.40
  • プロキシの構成:internet-facing(IPv4)、サブネット2つ(ap-northeast-1a / 1c)
  • aws-cli:2.42.4

ログの出力先と取得方法

プロセスのログは、ロググループ /aws/elb-proxy/<proxy-name> に出力されます。ログストリーム名は、プロキシの ENI の ID です。今回の構成ではサブネットが2つあり、それぞれのサブネットの ENI の ID を名前とするストリームが2本できました。

リクエストごとのアクセスログは、Envoy の設定で network access logger を指定して出力する別の仕組みです。

検証には、次の設定ファイル envoy.yaml を使いました。/direct へのリクエストには固定応答(200)を返し、それ以外のパスは checkip.amazonaws.com へ転送します。

envoy.yaml
admin:
  address:
    socket_address:
      address: 127.0.0.1
      port_value: 9901
static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 80
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: ingress_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match:
                  prefix: "/direct"
                direct_response:
                  status: 200
                  body:
                    inline_string: "Your proxy is running\n"
              - match:
                  prefix: "/"
                route:
                  cluster: checkip
                  auto_host_rewrite: true
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: checkip
    type: STRICT_DNS
    dns_lookup_family: V4_ONLY
    connect_timeout: 5s
    load_assignment:
      cluster_name: checkip
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: checkip.amazonaws.com
                port_value: 80

レベルを切り替えるたびに、curl で /direct と /forward に各3回、計6回の HTTP リクエスト(ポート80)を送りました。リクエストには、ログ上で見分けるために、クエリ文字列 lvl(レベル名)と n(回数)を付けました。

最初のリクエストを送ってから15秒間のログを、aws logs filter-log-events でロググループの全ストリームから取得し、イベント数を数えました。text のログは1行が1イベントです。

ロググループは、プロキシのログが書き込まれたときに作られます。プロキシの作成直後は、ロググループが存在しませんでした。

ログレベル

レベルの指定

ログレベルは、プロキシ属性 envoy.log_level に指定します。

aws elb-proxy update-proxy-attributes \
  --proxy-identifier <proxy-arn> \
  --attributes key=envoy.log_level,value=debug

指定できる値は off、critical、error、warning(別名 warn)、info、debug、trace で、この記事ではすべて試しました。作成直後の値は warn で、envoy.component_log_level は空でした。

debug の状態から warn を指定すると、update-proxy-attributes の応答の値は warn になりましたが、debug の出力が続きました。warning を指定すると、約6秒後に出力が止まりました。出力を抑えるレベルに戻すときは、warn ではなく warning を指定します。

https://docs.aws.amazon.com/elasticloadbalancing/latest/elbproxy/monitoring-log-level.html

レベルごとの出力

リクエスト開始から15秒間の、2ストリームの合計イベント数を数えました。各件数は1回の測定です。

envoy.log_level イベント数 出たコンポーネント
warn(既定、作成直後) ロググループなし なし
off 0 なし
critical 0 なし
error 0 なし
warning 0 なし
info 0 なし
debug 2,793 http、connection、conn_handler、upstream、pool、router、client、main、filter の9つ
trace 4,551 debug の9つに misc、dns、wasm、happy_eyeballs を加えた13

debug の2,793イベントの大半は、ヘルスチェックなどリクエスト以外の行です。6件のリクエストに対応する行は、次の節の表の合計で177イベントでした。

debug と trace では、リクエストがなくてもログが出続けます。debug では、リクエストを送っていない9.5秒間に1,942イベントが出ました。15秒間の message の文字数は、debug が331,953文字、trace が716,245文字でした(プロキシ1台、リクエストは6件)。ロググループの保持期間は未設定だったため、debug や trace のままにすると、トラフィックがなくても保存量が増え続けます。

レベルを変更した直後には、重大度が info の行がストリームごとに1行(2ストリームで2行)出ることがあります。info から error に変更したときは、次の行が出ました。

[2026-11-26 13:38:11.683][2290][info][misc] [external/envoy+/source/common/common/logger.cc:176] change all log levels: level='error'

この行は、変更前のレベルが info、debug、trace のときに出ました(debug から trace、trace から info、info から error)。error から critical への変更と、warn から debug への変更では出ませんでした。

リクエスト1件分の行

次は、debug で /direct(固定応答)にリクエストを1回送ったときの、そのリクエストの接続の行すべてです。ヘッダーの続きの行も含みます。

[2026-11-26 13:35:56.941][2352][debug][conn_handler] [external/envoy+/source/common/listener_manager/active_tcp_listener.cc:162] [Tags: "ConnectionId":"383"] new connection from <client-ip>:<port>
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/conn_manager_impl.cc:506] [Tags: "ConnectionId":"383"] new stream
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/conn_manager_impl.cc:1560] [Tags: "ConnectionId":"383","StreamId":"6151829858538851096"] request headers complete (end_stream=true):
':authority', '<proxy-dns>'
':path', '/direct?lvl=debug&n=1'
':method', 'GET'
'user-agent', 'curl/8.18.0'
'accept', '*/*'
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/conn_manager_impl.cc:1543] [Tags: "ConnectionId":"383","StreamId":"6151829858538851096"] request end stream timestamp recorded
[2026-11-26 13:35:56.941][2352][debug][connection] [external/envoy+/source/common/network/connection_impl.h:101] [Tags: "ConnectionId":"383"] current connecting state: false
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/filter_manager.cc:1143] [Tags: "ConnectionId":"383","StreamId":"6151829858538851096"] Preparing local reply with details direct_response
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/filter_manager.cc:1179] [Tags: "ConnectionId":"383","StreamId":"6151829858538851096"] Executing sending local reply.
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/conn_manager_impl.cc:2253] [Tags: "ConnectionId":"383","StreamId":"6151829858538851096"] encoding headers via codec (end_stream=false):
':status', '200'
'content-length', '22'
'content-type', 'text/plain'
'date', 'Thu, 26 Nov 2026 13:35:56 GMT'
'server', 'envoy'
[2026-11-26 13:35:56.941][2352][debug][http] [external/envoy+/source/common/http/conn_manager_impl.cc:2389] [Tags: "ConnectionId":"383","StreamId":"6151829858538851096"] Codec completed encoding stream.
[2026-11-26 13:35:56.948][2352][debug][connection] [external/envoy+/source/common/network/connection_impl.cc:833] [Tags: "ConnectionId":"383"] remote close
[2026-11-26 13:35:56.948][2352][debug][connection] [external/envoy+/source/common/network/connection_impl.cc:358] [Tags: "ConnectionId":"383"] closing socket: 0
[2026-11-26 13:35:56.948][2352][debug][conn_handler] [external/envoy+/source/common/listener_manager/active_stream_listener_base.cc:133] [Tags: "ConnectionId":"383"] adding to cleanup list
[2026-11-26 13:35:56.948][2352][debug][connection] [external/envoy+/source/common/network/connection_impl.cc:157] [Tags: "ConnectionId":"383"] Not closing conn, socket is not open

debug では、リクエストヘッダーとレスポンスヘッダーの値がそのまま出力されました。

1リクエストあたりのイベント数は、次のとおりです。/direct も /forward も、3回とも同じ件数でした。「先頭行」は、角括弧で始まる行の数です。数えたのは、そのリクエストの接続の行(ConnectionId が同じ行)です。

レベル /direct(固定応答) /forward(転送)
debug 23イベント(先頭行 13) 36イベント(先頭行 15)
trace 58イベント(先頭行 48) 87イベント(先頭行 59)

trace では、debug の行に加えて、接続とリクエストの処理を細かく追う、重大度が trace の行が出ます。

コンポーネント別のレベル

コンポーネントごとにレベルを変えるには、envoy.component_log_level に component:level をカンマで区切って指定します。次の例では、全体を warning にし、http と router だけを debug にしています。

aws elb-proxy update-proxy-attributes \
  --proxy-identifier <proxy-arn> \
  --attributes '[{"key":"envoy.log_level","value":"warning"},{"key":"envoy.component_log_level","value":"http:debug,router:debug"}]'

全体のレベルとの組み合わせを4通り試しました。表の debug/http は、重大度が debug、コンポーネントが http の行を表します。

envoy.log_level envoy.component_log_level 15秒間に出た先頭行の数(重大度/コンポーネント)
warning http:debug,router:debug debug/http 342、debug/router 24
warning http:debug debug/http 568 のみ
info router:debug debug/router 24 のみ
debug http:error http は 0。connection 334、upstream 106、conn_handler 110、router 24 など

指定したコンポーネントでは、全体のレベルよりコンポーネント別のレベルが優先されます。空文字列を渡すと、envoy.component_log_level の値は空に戻りました。

ログの書式

text

既定の書式は text で、パターンは [%Y-%m-%d %T.%e][%t][%l][%n] [%g:%#] %v です。1行は6つの項目からなります。表の例には、「リクエスト1件分の行」の節で示した new stream の行を使いました。

項目 フラグ 例
タイムスタンプ(UTC) %Y-%m-%d %T.%e 2026-11-26 13:35:56.941
スレッド ID %t 2352
重大度 %l debug
コンポーネント名 %n http
ソースファイルと行 %g:%# external/envoy+/source/common/http/conn_manager_impl.cc:506
メッセージ %v [Tags: "ConnectionId":"383"] new stream

接続に紐づく行では、メッセージの先頭に [Tags: "ConnectionId":"…"] が付き、リクエストに紐づく行では "StreamId":"…" も付きます。request headers complete のようにヘッダーが続くメッセージでは、2行目以降に角括弧の接頭辞が付きません。

JSON

JSON にするには、Envoy の設定に application_log_config を追加し、json_format にキーと書式フラグを指定します。メッセージには、JSON 用にエスケープして出力する %j を指定します。今回は、次のブロックを envoy.yaml の先頭に追加しました(残りは先に示した envoy.yaml と同じです)。

application_log_config:
  log_format:
    json_format:
      timestamp: "%Y-%m-%dT%T.%e%z"
      thread_id: "%t"
      level: "%l"
      component: "%n"
      source: "%g:%#"
      message: "%j"

設定は update-proxy-configuration で適用します。

aws elb-proxy update-proxy-configuration \
  --proxy-identifier <proxy-arn> \
  --cli-binary-format raw-in-base64-out \
  --configuration-file configurationBytes@=file://envoy.yaml

更新したときのレベルは、envoy.log_level が warning、envoy.component_log_level が http:debug,router:debug でした。更新後に /direct へ送ったリクエストの行は、次のとおりです。

{"timestamp":"2026-11-26T13:50:40.984+00:00","message":"new stream","source":"external/envoy+/source/common/http/conn_manager_impl.cc:506","thread_id":"3520","component":"http","level":"debug","ConnectionId":"23"}
{"timestamp":"2026-11-26T13:50:40.984+00:00","message":"request headers complete (end_stream=true):\n':authority', '<proxy-dns>'\n':path', '/direct?lvl=json&n=1'\n':method', 'GET'\n'user-agent', 'curl/8.18.0'\n'accept', '*/*'\n","source":"external/envoy+/source/common/http/conn_manager_impl.cc:1560","thread_id":"3520","component":"http","level":"debug","ConnectionId":"23","StreamId":"10006565570368311731"}

指定した6つのキーに加えて、接続に紐づく行には ConnectionId、リクエストに紐づく行には StreamId も付きました。ヘッダーのような複数行のメッセージは、text と違って行ごとに分かれず、改行を \n にした形で1つの message に入ります。

設定を更新すると、新しいプロセスが起動します。書式の変更は新しいプロセスに適用されるため、切り替えた直後は、text と JSON の行が混在します。

https://docs.aws.amazon.com/elasticloadbalancing/latest/elbproxy/monitoring-log-format.html

反映にかかる時間

update-proxy-attributes でレベルを変えたとき、新しいレベルが反映されるまでの時間は、コマンド開始から1.4〜5.9秒でした。スレッド ID は変わらず、再起動は伴いません。

update-proxy-configuration で設定を更新したとき、更新の状態が valid,complete になるまでの時間は、text から JSON への更新も JSON から text への更新も17秒でした。状態は2〜3秒おきに確認しました。更新で起動したプロセスの行は、スレッド ID が更新前と異なります。

まとめ

ELB for Envoy のプロセスのログには、debug と trace でリクエストごとの処理が出力されました。

これらのレベルでは、詳細な追跡やデバッグに使える情報が得られます。一方で、大量のログが生成され、CloudWatch Logs の費用が増える可能性があります。ログレベルは段階的に変更し、変更後はログの記録量を確認してください。

平時の正常動作はアクセスログで確認し、プロセスのログは warning 以上を保存することをおすすめします。

https://dev.classmethod.jp/articles/elb-for-envoy-access-log-cloudwatch-logs/

この記事をシェアする

AWSのお困り事はクラスメソッドへ

関連記事