<p>I installed Istio with</p>

<pre><code>gateways.istio-egressgateway.enabled = true
</code></pre>

<p>I have a service that consumes external services, so I define the following egress rule.</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: external-service1
spec:
  hosts:
  - external-service1.com
  ports:
  - number: 80
    name: http
    protocol: HTTP
  - number: 443
    name: https
    protocol: HTTPS
  resolution: DNS
  location: MESH_EXTERNAL
</code></pre>

<p>But using Jaeger I can not see the traffic to the external service, and thus be able to detect problems in the network.</p>

<p>I'm forwarding the appropriate headers to the external service (x-request-id, x-b3-traceid, x-b3-spanid, b3-parentspanid, x-b3-sampled, x-b3-flags, x-ot-span-context)</p>

<p>Is this the correct behavior?
what is happening?
Can I only have statistics of internal calls?
How can I have statistics for egress traffic?</p>

user60108
<p>Assuming that your services are  defined in Istio’s internal service registry. If not please configure it according to instruction <a href="https://istio.io/docs/tasks/traffic-management/egress/" rel="nofollow noreferrer"><code>service-defining</code></a>.</p>

<p>In HTTPS all the HTTP-related information like method, URL path, response code, is encrypted so Istio <strong>cannot</strong> see and cannot monitor that information for HTTPS. 
If you need to monitor HTTP-related information in access to external HTTPS services, you may want to let your applications issue HTTP requests and configure Istio to perform TLS origination.</p>

<p>First you have to <strong>redefine</strong> your ServiceEntry and create VirtualService  to rewrite the HTTP request port and add a DestinationRule to perform TLS origination.</p>

<pre><code>kubectl apply -f - &lt;&lt;EOF
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: external-service1
spec:
  hosts:
  - external-service1.com
  ports:
  - number: 80
    name: http-port
    protocol: HTTP
  - number: 443
    name: http-port-for-tls-origination
    protocol: HTTP
  resolution: DNS
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: external-service1
spec:
  hosts:
  - external-service1.com
  http:
  - match:
    - port: 80
    route:
    - destination:
        host: external-service1.com
        port:
          number: 443
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: external-service1
spec:
  host: external-service1.com
  trafficPolicy:
    loadBalancer:
      simple: ROUND_ROBIN
    portLevelSettings:
    - port:
        number: 443
      tls:
        mode: SIMPLE # initiates HTTPS when accessing external-service1.com
EOF
</code></pre>

<p>The VirtualService redirects HTTP requests on port 80 to port 443 where the corresponding DestinationRule then performs the TLS origination. Unlike the previous ServiceEntry, this time the protocol on port 443 is HTTP, instead of HTTPS, because clients will only send HTTP requests and Istio will upgrade the connection to HTTPS.</p>

<p>I hope it helps.</p>
