Collect logs for specific pods in a namespace and nothing else.
Collect logs for all pods in specific namespaces and nothing else.
I want to avoid filebeat picking up all container logs from every node. The other option is to run it as sidecar with the relevant pod but I'd like to avoid this approach.
Yes, you can use hints-based autodiscover to provide a different configuration per pod or namespace. Hints are defined as annotations in your kubernetes resources.
In the main configuration file you would need this setup:
This tells the autodiscover provider to enable hints, to take into account namespace metadata, and as default configuration for each pod, it disables the inputs.
Then you can add configurations per namespace, or per pod. Adding an annotation like the following one will enable the inputs selectively:
annotations:
co.elastic.logs/enabled: 'true'
If you do it in a pod, its logs will be collected. If you do it in a namespace, the logs of all the pods in this namespace will be collected.
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.