I have followed the ECK quickstart and can get to run a 3 replicas of Elasticsearch on my k8s cluster, and kibana as well.
Next step is to configure filebeat and logstash to capture the nginx logs from my other pods in the cluster.
I followed this ECK Beats Quickstart to setup basic filebeat and it works fine.
Now I am trying to add the nginx
module, but I can't seems to get it to access the nginx logs from other pods. Here is the only configuration that didn't break starting filebeat:
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: jsc-filebeat
namespace: jsc-ns
spec:
type: filebeat
version: 8.17.2
# elasticsearchRef:
# name: jsc-elasticsearch
config:
filebeat.inputs:
- type: filestream
id: nginx-filestream-id
enabled: true
paths:
- /var/log/nginx/access.log
fields:
nginx: true
output.logstash:
hosts: ["jsc-logstash-ls-beats:5044"]
daemonSet:
podTemplate:
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
securityContext:
runAsUser: 0
containers:
- name: filebeat
volumeMounts:
- name: varlognginx
mountPath: /var/log/nginx
volumes:
- name: varlognginx
hostPath:
path: /var/log/nginx
If I write directly in the /var/log/nginx/access.log
file on the filebeat
pod, all works fine. But what I am looking for is to be able to get also the nginx files from other pods. I thought the daemonSet
would do that. What am I missing?