Hi, I was wondering how I can override the log configuration in Rancher.
As I understand, rancher loads fluentd image configuration and modifies it with its own settings. Here is an example of a project.conf running within a fluentd container.
What would be the concrete steps I have to take to override this project.conf with a different record_transformer ( to add or remove my own keywords ) or put in a multiline filter stanza?
Lets consider the most basic case, lets say I want to remove the projectID from the configuration. What would I need to do for this to happen in rancher? Do I have modify the base fluentd image? The kubernetes_metadata_filter plugin? Some rancher code?
<filter c-nllvr:p-78zvn.**>
@type record_transformer
enable_ruby true
tag ${tag}
namespace ${record[“kubernetes”][“namespace_name”]}
projectID c-nllvr:p-78zvn <— how I can remove this ?
I assumed I have to edit some base fluentd.conf file somewhere but I wasn’t sure where it was set for rancher. It seems that rancher keeps overriding any fluentd settings you’d throw at it. I checked the rancher source code and found a fluentd project logging template in ./rancher/pkg/controllers/user/logging/generator/project_template.go
<filter {{$store.ProjectName}}.**>
@type kubernetes_metadata
merge_json_log true
preserve_json_log true
<filter {{$store.ProjectName}}.**>
@type record_transformer
enable_ruby true
tag ${tag}
namespace ${record[“kubernetes”][“namespace_name”]}
{{range $k, $val := $store.OutputTags -}}
{{$k}} {{$val}}
{{end -}}
projectID {{$store.ProjectName}}
<filter {{$store.ProjectName}}.**>
@type grep
key namespace
pattern {{$store.GrepNamespace}}
It seems to match perfectly to what I see running in the fluentd containers. But how do (should?) I override that? If I start editing an internal rancher template source code I would have to restart rancher after every filtering change and also have to branch from the main rancher release. There has to be a better (correct) way to edit per-project fluentd configuration without affecting everything else.
Thanks,
Ilya