Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filter_kubernetes: new configuration property 'kube_tag_prefix'
Kubernetes filter in Fluent Bit uses incoming record Tags to resolve local metadata such as pod name and namespace. When used in conjunction with in_tail a configured/expected tag could be changed leading to make the filter regular expressions to fail. The new 'kube_tag_prefix' configuration property aims to provide a way for the user to specify what's the Tag prefix used in in_tail. It can be used as follows: [INPUT] Name tail Path /var/log/containers/*.log Tag kube.service.* [FILTER] Name kubernetes Match * Kube_Tag_Prefix kube.service. The default value for Kube_Tag_Prefix is 'kube.var.log.containers.' As a side note, here is a simple explanation of the workflow: - A container log is stored as /var/log/container/apache-logs-annotated_default_apache-2367.log - Tail plugin read the file and emit a record with it content with the following tag: => kube.service.var.log.containers.apache-logs-annotated_default_apache-2367.log as you can see the Tag is expanded with the absolute path of the monitored file and also all slashes (/) are replaced with dots (.). - Filter Kubernetes needs to get the basename of the monitored file, so it uses the Tag associated for such purpose. Here Kube_Tag_Prefix is used to remove the prefix from the Tag appended previously in the Tail section: => apache-logs-annotated_default_apache-2367.log - Filter Kubernetes apply a Regex to lookup podname and namespace from the new content generated above ending in: podname = 'apache-logs' and namespace = 'default'. With this new approach is possible to define custom Tags on Tail and make Filter Kubernetes still compatible with that. Signed-off-by: Eduardo Silva <[email protected]>
- Loading branch information