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?
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
Just a note, within rancher the json output of a docker daemon and the built-in fluentd are immutable unless you want to change rancher sourcecode (not recommended).
Solution was to spin up my own fluentd server with this plugin
It will automatically pick up json inputs from rancher and then, using a regex, will combine them into a single message. I’ve tested it and it works. The best thing is you can use the stream_identity_key tag to uniquely identify message sources so you don’t try to combine items from various locations creating a Frankenstein event.