# Request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

**URL:** <https://discuss.elastic.co/t/request-canceled-while-waiting-for-connection-client-timeout-exceeded-while-awaiting-headers/204217>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [October 18, 2019, 11:41am UTC](https://discuss.elastic.co/t/request-canceled-while-waiting-for-connection-client-timeout-exceeded-while-awaiting-headers/204217 "2019-10-18T11:41:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrathore18](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vrathore18/32/88411_2.png) [@vrathore18](https://discuss.elastic.co/u/vrathore18)\
**Post date:** [October 18, 2019, 11:41am UTC](https://discuss.elastic.co/t/request-canceled-while-waiting-for-connection-client-timeout-exceeded-while-awaiting-headers/204217/1 "2019-10-18T11:41:19Z")

</div>

I am using below code snippet

```auto
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-config
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  filebeat.yml: |-
    filebeat.config:
      inputs:
        # Mounted `filebeat-inputs` configmap:
        path: ${path.config}/inputs.d/*.yml
        # Reload inputs configs as they change:
        reload.enabled: false
      modules:
        path: ${path.config}/modules.d/*.yml
        # Reload module configs as they change:
        reload.enabled: false

    processors:
      - add_cloud_metadata:

    output.elasticsearch:
      hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: filebeat-inputs
  namespace: kube-system
  labels:
    k8s-app: filebeat
data:
  kubernetes.yml: |-
    - type: docker
      containers.ids:
      - "*"
      processors:
        - add_kubernetes_metadata:
            in_cluster: true
      fields:
        aws_account_id: ${aws_account_id} 
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: filebeat
  namespace: kube-system
  labels:
    k8s-app: filebeat
spec:
  template:
    metadata:
      labels:
        k8s-app: filebeat
    spec:
      serviceAccountName: filebeat
      terminationGracePeriodSeconds: 30
      containers:
      - name: filebeat
        image: docker.elastic.co/beats/filebeat:6.3.2
        args: [
          "-c", "/etc/filebeat.yml",
          "-e",
        ]
        env:
        - name: ELASTICSEARCH_HOST
          value: ${elasticsearch_host}
        - name: ELASTICSEARCH_PORT
          value: "443"
        securityContext:
          runAsUser: 0
        resources:
          limits:
            memory: 256Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - name: config
          mountPath: /etc/filebeat.yml
          readOnly: true
          subPath: filebeat.yml
        - name: inputs
          mountPath: /usr/share/filebeat/inputs.d
          readOnly: true
        - name: data
          mountPath: /usr/share/filebeat/data
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
      volumes:
      - name: config
        configMap:
          defaultMode: 0600
          name: filebeat-config
      - name: varlibdockercontainers
        hostPath:
          path: /var/lib/docker/containers
      - name: inputs
        configMap:
          defaultMode: 0600
          name: filebeat-inputs
      # We set an `emptyDir` here to ensure the manifest will deploy correctly.
      # It's recommended to change this to a `hostPath` folder, to ensure internal data
      # files survive pod changes (ie: version upgrade)
      - name: data
        emptyDir: {}

```

I am using ELASTICSEARCH\_PORT value: "443" but in logs I can see below error:

Failed to connect: Get **[https://xxxxxxxxxxx:9200/:443](https://xxxxxxxxxxx:9200/:443)** : net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

When I am curling from the filebeat pod. I can curl [https://xxxxxxxxxxx](https://xxxxxxxxxxx/) or [https://xxxxxxxxxxx:443](https://xxxxxxxxxxx/) but not with 9200.

P.S: I am using using AWS elasticsearch service.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 15, 2019, 11:41am UTC](https://discuss.elastic.co/t/request-canceled-while-waiting-for-connection-client-timeout-exceeded-while-awaiting-headers/204217/2 "2019-11-15T11:41:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
