diff --git a/config-reloader/processors/mounted_file.go b/config-reloader/processors/mounted_file.go
index 351d3ff9..e2432c6b 100644
--- a/config-reloader/processors/mounted_file.go
+++ b/config-reloader/processors/mounted_file.go
@@ -18,10 +18,11 @@ const mountedFileSourceType = "mounted-file"
// ContainerFile stores parsed info from a @type mounted-file...
type ContainerFile struct {
- Labels map[string]string
- AddedLabels map[string]string
- Path string
- Parse *fluentd.Directive
+ Labels map[string]string
+ AddedLabels map[string]string
+ Path string
+ Parse *fluentd.Directive
+ BypassParams map[string]string
}
type mountedFileState struct {
@@ -69,6 +70,13 @@ func (state *mountedFileState) Prepare(input fluentd.Fragment) (fluentd.Fragment
}
cf.Path = paramPath
+ cf.BypassParams = map[string]string{}
+ for k, el := range frag.Params {
+ if !contains([]string{"labels", "add_labels", "path"}, k) {
+ cf.BypassParams[el.Name] = el.Value
+ }
+ }
+
if len(frag.Nested) == 1 {
cf.Parse = frag.Nested[0]
} else if len(frag.Nested) >= 2 {
@@ -105,6 +113,10 @@ func (state *mountedFileState) convertToFragement(cf *ContainerFile) fluentd.Fra
}
dir.SetParam("@type", "tail")
+ for k, el := range cf.BypassParams {
+ dir.SetParam(k, el)
+ }
+
hostPath := state.makeHostPath(cf, hm, mc)
pos := util.Hash(state.Context.DeploymentID, fmt.Sprintf("%s-%s-%s", mc.PodID, mc.Name, hostPath))
tag := fmt.Sprintf("kube.%s.%s.%s-%s", state.Context.Namespace, mc.PodName, mc.Name, pos)
diff --git a/config-reloader/processors/mounted_file_test.go b/config-reloader/processors/mounted_file_test.go
index 39514d0d..c30070d4 100644
--- a/config-reloader/processors/mounted_file_test.go
+++ b/config-reloader/processors/mounted_file_test.go
@@ -338,6 +338,9 @@ func TestProcessMountedFile(t *testing.T) {
@type mounted-file
path /var/log/redis.log
labels app=redis
+ read_from_head false
+ refresh_interval 1s
+ multiline_flush_interval 1s
@@ -366,6 +369,9 @@ func TestProcessMountedFile(t *testing.T) {
assert.Equal(t, "/kubelet-root/pods/123-id/volumes/kubernetes.io~empty-dir/logs/redis.log", prep[0].Param("path"))
assert.Equal(t, "/kubelet-root/pods/abc-id/volumes/kubernetes.io~empty-dir/logs/nginx.log", prep[2].Param("path"))
assert.Equal(t, "/kubelet-root/pods/abc-sub-id/volumes/kubernetes.io~empty-dir/logs/files/nginx.log", prep[4].Param("path"))
+ assert.Equal(t, "true", prep[0].Param("read_from_head"))
+ assert.Equal(t, "1s", prep[0].Param("refresh_interval"))
+ assert.Equal(t, "1s", prep[0].Param("multiline_flush_interval"))
payload := prep.String()
assert.True(t, strings.Contains(payload, "'container_image'=>'image-c2'"))