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

9/17/2019

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.

-- Nish
docker
elastic-stack
elasticsearch
fluentd
kubernetes

1 Answer

9/17/2019

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"
        ...
-- Veerendra Kakumanu
Source: StackOverflow