アプリケーションのログとメトリクスの収集
このセクションでは、Istio 用 Sumo Logic アプリケーションでログとメトリクスを収集する手順を説明します。ログとメトリクスは、Sumo Logic Helm チャートで収集されます。Istio のサンプル メトリクスとサンプル ログ メッセージ、そしてクエリの例も示してあります。
ログとメトリクスのタイプ
Istio のコンポーネントは、Istio 用 Sumo Logic アプリケーションが活用する柔軟なロギング フレームワークで構築されます。Itsio 用 Sumo Logic アプリケーションは、以下の Istio コンポーネントからのログを利用します。
- Envoy - Envoy は、サービス メッシュ内のすべてのサービスのインバウンド トラフィックとアウトバウンド トラフィックを調整します。
- Mixer - サービス メッシュ全体にアクセス制御や使用のポリシーを適用し、Envoy プロキシや他のサービスからテレメトリ データを収集します。
- Pilot - インテリジェントなルーティングや回復性を実現するトラフィック管理機能である Envoy Sidecar にサービス発見機能を提供します。
- Citadel - 内部に組み込まれている ID および資格情報管理機能によって、サービス間での強力なエンド ユーザ認証を可能にします。
- Galley - Istio の設定検証、取り込み、処理、および配布を担当します。
- Sidecar Injector - Webhook として機能し、ユーザが作成したポッドにプロキシを自動的に追加します。
- Ingress Gateway および Egress Gateway ログ - サービス メッシュ外でサービスを公開し、メッシュ内のアプリケーションから外部 HTTP サービスと HTTPS サービスへのアクセスを可能にします。
Istio のメトリクス タイプの詳細については、このページの「サンプル メトリクス」のセクションを参照してください。Istio ログの詳細については、このページの「サンプル ログ メッセージ」のセクションを参照してください。Istio ログの詳細については、Istio ドキュメントを参照してください。
収集の概要
次のケース別に、Sumo Logic Helm チャートによるログとメトリクスの収集を設定します。
- すでに Kubernetes 収集がセットアップされている
- まだ Kubernetes 収集がセットアップされていない
メトリクスおよびログ収集の設定
メトリクス収集のセットアップには 2 つのケースがあります。
現在の状況に合わせて適切な手順を使用してください。
A. すでに Kubernetes 収集がセットアップされている
すでに Kubernetes 収集をセットアップしてある場合は、この作業を行います。そうでなければ、下記の作業 B に進みます。
Kubernetes 収集がすでにセットアップされている状態で Istio のメトリクスとログを収集するには、以下のいずれかの手順を実行します。
- インストール時に Sumo Logic Helm チャートを使用していない場合は、以下を実行します。
- 使用した prometheus overrides ファイルを探します。
- prometheus overrides ファイルの prometheusSpec フィールドの additionalScrapeConfigs セクションに、次のスクレイプ設定を追加します。これらの設定により、メトリクス用の Istio エンドポイントがスクレイプされます。
- 以下の remoteWrite ルールを prometheus overrides ファイルに追加して、スクレイプされた Istio メトリクスを Sumo Logic に送信します。Istio のスクレイプ設定とルールが追加された prometheus-overrides.yaml の例は、この .yaml ファイルを参照してください。
- 次のコマンドを使用して、メトリクスを Prometheus に取り込むように Prometheus operator をアップグレードします。
helm upgrade prometheus-operator stable/prometheus-operator -f prometheus-overrides.yaml
- インストール時に Sumo Logic Helm チャートを使用した場合は、以下を実行します。
- 次の方法で、Helm チャート値ファイルを更新します。
- values.yaml ファイルの prometheusSpec フィールドに、この additionalScrapeConfigs セクションを追加します。これらの設定により、メトリクス用の Istio エンドポイントがスクレイプされます。
- values.yaml ファイルの remoteWrite セクションにこれらのルールを追加します。これによってスクレイプされたメトリクスが Sumo Logic に送信されます。
- 次のコマンドで、Sumo Logic Helm チャートをアップグレードします。
helm upgrade collection-sumologic sumologic/sumologic -f values.yaml
B. まだ Kubernetes 収集がセットアップされていない
まだ Kubernetes 収集 がセットアップされていない場合は、この作業を行います。
Kubernetes 収集と、Istio のログおよびメトリクス収集をセットアップするには、次の手順を実行します。
- Helm を使用してデプロイします。
- values.yaml に additionalScrapeConfigs および remoteWrite ルールを次のように追加します。
- values.yaml の prometheusSpec フィールドに、この additionalScrapeConfigs セクションを追加します。これらの設定により、メトリクス用の Istio エンドポイントがスクレイプされます。
- values.yaml の remoteWrite セクションにこれらのルールを追加します。これによってスクレイプされたメトリクスが Sumo Logic に送信されます。
- 次のコマンドで、Sumo Logic Helm チャートをアップグレードします:
helm upgrade collection-sumologic sumologic/sumologic -f values.yaml
サンプル ログとサンプル メトリクス
このセクションでは、Istio のサンプル メトリクスとサンプル ログ メッセージを示します。
Istio アプリケーションは、以下の Istio コンポーネントからのログを利用します。
- Envoy
- Mixer
- Citadel
- Galley
- Pilot
- Sidecar Injector
- Ingress Gateway および Egress Gateway ログ
Istio のログとメトリクスの詳細については、この Istio ドキュメントを参照してください。
サンプル メトリクス
Citadel |
citadel_secret_controller_csr_err_count citadel_secret_controller_secret_deleted_cert_count citadel_secret_controller_svc_acc_created_cert_count citadel_secret_controller_svc_acc_deleted_cert_count citadel_server_authentication_failure_count citadel_server_citadel_root_cert_expiry_timestamp citadel_server_csr_count citadel_server_csr_parsing_err_count citadel_server_id_extraction_err_count citadel_server_success_cert_issuance_count |
Envoy |
galley_istio_authentication_meshpolicies galley_istio_mesh_MeshConfig galley_istio_networking_destinationrules galley_istio_networking_gateways galley_istio_networking_virtualservices galley_istio_policy_attributemanifests galley_istio_policy_handlers galley_istio_policy_instances galley_istio_policy_rules galley_mcp_source_clients_total galley_mcp_source_message_sizes_bytes_bucket galley_mcp_source_message_sizes_bytes_count galley_mcp_source_message_sizes_bytes_sum galley_mcp_source_request_acks_total galley_runtime_processor_events_processed_total galley_runtime_processor_event_span_duration_milliseconds_bucket galley_runtime_processor_event_span_duration_milliseconds_count galley_runtime_processor_event_span_duration_milliseconds_sum galley_runtime_processor_snapshots_published_total galley_runtime_processor_snapshot_events_total_bucket galley_runtime_processor_snapshot_events_total_count galley_runtime_processor_snapshot_events_total_sum galley_runtime_processor_snapshot_lifetime_duration_milliseconds_bucket galley_runtime_processor_snapshot_lifetime_duration_milliseconds_count galley_runtime_processor_snapshot_lifetime_duration_milliseconds_sum galley_runtime_state_type_instances_total galley_runtime_strategy_on_change_total galley_runtime_strategy_timer_max_time_reached_total galley_runtime_strategy_timer_quiesce_reached_total galley_runtime_strategy_timer_resets_total galley_source_kube_dynamic_converter_success_total galley_source_kube_event_success_total galley_validation_cert_key_updates galley_validation_config_load galley_validation_config_updates galley_validation_passed |
Galley |
galley_istio_authentication_meshpolicies galley_istio_mesh_MeshConfig galley_istio_networking_destinationrules galley_istio_networking_gateways galley_istio_networking_virtualservices galley_istio_policy_attributemanifests galley_istio_policy_handlers galley_istio_policy_instances galley_istio_policy_rules galley_mcp_source_clients_total galley_mcp_source_message_sizes_bytes_bucket galley_mcp_source_message_sizes_bytes_count galley_mcp_source_message_sizes_bytes_sum galley_mcp_source_request_acks_total galley_runtime_processor_events_processed_total galley_runtime_processor_event_span_duration_milliseconds_bucket galley_runtime_processor_event_span_duration_milliseconds_count galley_runtime_processor_event_span_duration_milliseconds_sum galley_runtime_processor_snapshots_published_total galley_runtime_processor_snapshot_events_total_bucket galley_runtime_processor_snapshot_events_total_count galley_runtime_processor_snapshot_events_total_sum galley_runtime_processor_snapshot_lifetime_duration_milliseconds_bucket galley_runtime_processor_snapshot_lifetime_duration_milliseconds_count galley_runtime_processor_snapshot_lifetime_duration_milliseconds_sum galley_runtime_state_type_instances_total galley_runtime_strategy_on_change_total galley_runtime_strategy_timer_max_time_reached_total galley_runtime_strategy_timer_quiesce_reached_total galley_runtime_strategy_timer_resets_total galley_source_kube_dynamic_converter_success_total galley_source_kube_event_success_total galley_validation_cert_key_updates galley_validation_config_load galley_validation_config_updates galley_validation_passed |
Mixer |
mixer_config_adapter_info_configs_total mixer_config_adapter_info_config_errors_total mixer_config_attributes_total mixer_config_handler_configs_total mixer_config_handler_validation_error_total mixer_config_instance_configs_total mixer_config_instance_config_errors_total mixer_config_rule_configs_total mixer_config_rule_config_errors_total mixer_config_rule_config_match_error_total mixer_config_template_configs_total mixer_config_template_config_errors_total mixer_config_unsatisfied_action_handler_total mixer_dispatcher_destinations_per_request_bucket mixer_dispatcher_destinations_per_request_count mixer_dispatcher_destinations_per_request_sum mixer_dispatcher_destinations_per_variety_total mixer_dispatcher_instances_per_request_bucket mixer_dispatcher_instances_per_request_count mixer_dispatcher_instances_per_request_sum mixer_handler_closed_handlers_total mixer_handler_daemons_total mixer_handler_handler_build_failures_total mixer_handler_handler_close_failures_total mixer_handler_new_handlers_total mixer_handler_reused_handlers_total mixer_loadshedding_requests_throttled mixer_mcp_sink_reconnections mixer_mcp_sink_recv_failures_total mixer_mcp_sink_request_acks_total mixer_runtime_dispatches_total mixer_runtime_dispatch_duration_seconds_bucket mixer_runtime_dispatch_duration_seconds_count mixer_runtime_dispatch_duration_seconds_sum |
Istio |
istio_requests_total istio_request_bytes_bucket istio_request_bytes_count istio_request_bytes_sum istio_request_duration_seconds_bucket istio_request_duration_seconds_count istio_request_duration_seconds_sum istio_response_bytes_bucket istio_response_bytes_count istio_response_bytes_sum |
ログ メッセージのサンプル
Citadel | {"timestamp":1567229498836,"log":"2019-08-31T05:31:38.836754Z\tinfo\tSecret kubernetes-dashboard/istio.kubernetes-dashboard is created successfully","stream":"stdout","time":"2019-08-31T05:31:38.836953218Z"} |
Envoy | {"timestamp":1567599304394,"log":"[2019-09-04 12:15:04.394][14][warning][config] [bazel-out/k8-opt/bin/external/envoy/source/common/config/_virtual_includes/grpc_stream_lib/common/config/grpc_stream.h:86] gRPC config stream closed: 13, ","stream":"stderr","time":"2019-09-04T12:15:04.394322584Z"} |
Galley | {"timestamp":1566840793724,"log":"2019-08-26T17:33:13.679104Z\tinfo\tmcp\tSetSnapshot(): respond to watch 21 for istio/networking/v1alpha3/gateways @ version \"30\"","stream":"stdout","time":"2019-08-26T17:33:13.724575625Z"} |
Mixer | {"timestamp":1566752321320,"log":"2019-08-25T16:58:41.319910Z\terror\tistio.io/istio/pkg/kube/secretcontroller/secretcontroller.go:148: Failed to list *v1.Secret: Get https://10.56.0.1:443/api/v1/namespa...ourceVersion=0: net/http: TLS handshake timeout","stream":"stdout","time":"2019-08-25T16:58:41.320068921Z"} |
Pilot | {"timestamp":1567599723043,"log":"2019-09-04T12:22:03.043108Z\tinfo\tads\tRDS: PUSH for node:reviews-v3-6fbc779988-p99c7.default routes:18","stream":"stdout","time":"2019-09-04T12:22:03.043357438Z"} |
Sidecar Injector |
View as JSON (JSON 形式で表示) {"timestamp":1566752321306,"log":"2019-08-25T16:58:41.305874Z\terror\tistio.io/istio/pilot/cmd/sidecar-injector/main.go:173: Failed to list *v1beta1.MutatingWebhookConfiguration: Get https://10.56.0.1:443/apis/admission...ourceVersion=0: net/http: TLS handshake timeout","stream":"stdout","time":"2019-08-25T16:58:41.306191001Z"} |
Ingress Gateway および Egress Gateway ログ | {"timestamp":1567599258659,"log":"[2019-09-04T12:14:11.483Z] \"GET /productpage HTTP/1.1\" 200 - \"-\" \"-\" 0 4183 40 39 \"10.44.1.1\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36\" \"48408b99-bf18-9216-a369-dc471e889790\" \"35.238.76.93\" \"10.44.1.12:9080\" outbound|9080||productpage.default.svc.cluster.local - 10.44.1.4:80 10.44.1.1:60315 -","stream":"stdout","time":"2019-09-04T12:14:18.659156219Z"} |
クエリのサンプル
_collector="gke-istio-collector" | json field=_raw "time", "log.sourceApp" ,"log.destinationApp","log.level", "log.latency", "log.responseCode", "log.url", "log.sentBytes", "log.receivedBytes" as time, source, destination, level, latency, response, url, bytes_out, bytes_in