fluent / fluentd-kubernetes-daemonset

Fluentd daemonset for Kubernetes and it Docker image
Apache License 2.0
1.27k stars 981 forks source link

[out_graylog] failed to flush the buffer. Name or service not known plugin_id="out_graylog" #437

Closed sonntag-dev closed 4 years ago

sonntag-dev commented 4 years ago

Hello there,

I would like to run a fluentd daemonset in my kubernetes cluster. Then fluentd should send logs to graylog. But I get no messages for graylog GELF UDP input stream. My graylog instance is running in the same cluster.

In the fluentd logs I get this error message:

[out_graylog] failed to flush the buffer. error_class="SocketError" error="getaddrinfo: Name or service not known" plugin_id="out_graylog"

My fluentd-daemonset.yaml:

---
  apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    name: fluentd-ds
    namespace: logging
    labels:
      k8s-app: fluentd-logging
      version: v1
  spec:
    selector:
      matchLabels:
        k8s-app: fluentd-logging
        version: v1
    updateStrategy:
      type: RollingUpdate
    template:
      metadata:
        labels:
          k8s-app: fluentd-logging
          version: v1
      spec:
        serviceAccount: fluentd-sa
        serviceAccountName: fluentd-sa
        containers:
        - name: fluentd
          image: fluent/fluentd-kubernetes-daemonset:v1-debian-graylog
          imagePullPolicy: IfNotPresent
          env:
            - name:  FLUENT_GRAYLOG_HOST
              value: "http://<ip-where-my-graylog-instance-is-running>/"
            - name:  FLUENT_GRAYLOG_PORT
              value: "12201"
            - name: FLUENTD_SYSTEMD_CONF
              value: "disable"
          resources:
            requests:
              cpu: 200m
              memory: 0.5Gi
            limits:
              cpu: 1000m
              memory: 1Gi
          volumeMounts:
          - name: varlog
            mountPath: /var/log
          - name: varlibdockercontainers
            mountPath: /var/lib/docker/containers
            readOnly: true
        terminationGracePeriodSeconds: 30
        volumes:
        - name: varlog
          hostPath:
            path: /var/log
        - name: varlibdockercontainers
          hostPath:
            path: /var/lib/docker/containers

Any ideas?

Thanks in advance.

peetasan commented 4 years ago

Have you tried omitting the protocol htpp://? This way it works for me. (version: fluent/fluentd-kubernetes-daemonset:v1.11.2-debian-graylog-1.0)

cosmo0920 commented 4 years ago

Yeah, FLUENT_GRAYLOG_HOST doesn't handle http:// schema. It just handles hostname: https://github.com/graylog-labs/gelf-rb/blob/master/lib/gelf/notifier.rb#L42