Search code examples
dockerelasticsearchkuberneteselastic-stackfluentd

How can I collect the pod logs using fluentd and send the logs to elasticsearch?


I am trying to push the stdout logs which we see using below command to the elastic search using fluentd. I am not sure what can I do?

Kubectl logs -f <podname>

This shows all the SYSOUT logs getting printed via Java application. I want these logs to be available in elasticsearch.


Solution

  • Did you check this?

    From above link

    1. Get fluentd deamonset
    2. Tweak the deamonset manifest file like below(as mentioned in that link)
    apiVersion: extensions/v1beta1
    kind: DaemonSet
    metadata:
      name: fluentd
      namespace: kube-system
      ...
    spec:
        ...
        spec:
          containers:
          - name: fluentd
            image: quay.io/fluent/fluentd-kubernetes-daemonset
            env:
              - name:  FLUENT_ELASTICSEARCH_HOST
                value: "elasticsearch-logging"
              - name:  FLUENT_ELASTICSEARCH_PORT
                value: "9200"
            ...