Hi,
I have a kubernetes cluster on which I have deployed the elastic stack using ECK. I have several microservices deployed in the cluster as pods and I want to fetch logs from particular microservice pods.
Also I have created a specific json log file for every microservice and I want to ship that particular file using filebeat. With my current configuration filebeat is sending logs of every container.
One more thing all the logs of microservices pods are being saved on persistent volume. Is there a way to mount that volume to filebeat and get those particular logs.
Yes, you can mount the volume into Filebeat's pod and read the logs directly from there. On a quick glance over your manifest, it seems you've done it already:
The configuration for a Filebeat running on Kubernetes is essentially no different from a Filebeat running directly on a Linux box: Filebeat will read log files from a directory, the only difference there is that when Filebeat is on a container (like on Kubernetes), you need to mount the logs from the host into the container.
In your case, it seems, you just need to be mode specific on which files you want to read, because the configuration you posted is reading all files on:
So I want to fetch logs specifically from two pods and mount path for both of them is different.
For one of them its /logistic and for one of them is /rental.
Hi @TiagoQueiroz ,
In my case filebeat is sending logs of all containers, I want to restrict that and ship logs of only specific containers.
Is this possible through filebeat?
You can specifiy specific files/file paths. If you look at /var/log/containers/, you'll notice that the deployment is part of the file, e.g: coredns-64897985d-hcqbt_kube-system_coredns-0ae69813124edbc953d6b5db8a91585c01f80e538a3e0723ea55697c9988f5eb.log
You can use some processors to filter out some events/files. Things like podname, namespace, etc should be part of the event and allow for dropping the event.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.