diff --git a/docs/promtail.md b/docs/promtail.md index ff8b3bc9cc5c89e6f4dfb0b02ae1d5e2453edaeb..2b0e5dffc030779848bf7daf540dcf39ae953a21 100644 --- a/docs/promtail.md +++ b/docs/promtail.md @@ -32,7 +32,8 @@ The term "label" here is used in more than one different way and they can be eas will have a label \_\_meta_kubernetes_pod_label_name with value set to "foobar". * There are other \_\_meta_kubernetes_* labels based on the Kubernetes metadadata, such as the namespace the pod is running (\_\_meta_kubernetes_namespace) or the name of the container inside the pod (\_\_meta_kubernetes_pod_container_name) -* The label \_\_path\_\_ is a special label which Promtail will read to find out where the log files are to be read in. +* The label \_\_path\_\_ is a special label which Promtail will read to find out where the log files are to be read in, + it will be translated into a label named `filename` to ensure uniqueness of the streams. The most important part of each entry is the *relabel_configs* which are a list of operations which creates, renames, modifies or alters labels. A single scrape_config can also reject logs by doing an "action: drop" if diff --git a/pkg/promtail/promtail_test.go b/pkg/promtail/promtail_test.go index 02cfa5c11302e27ed2657283a3a83405256c4e9c..10d099a57e8a9af8a2a1da57710a33f927397c48 100644 --- a/pkg/promtail/promtail_test.go +++ b/pkg/promtail/promtail_test.go @@ -380,13 +380,13 @@ func (h *testServerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } file := "" for _, label := range labels { - if label.Name == "__filename__" { + if label.Name == "filename" { file = label.Value continue } } if file == "" { - h.t.Error("Expected to find a label with name __filename__ but did not!") + h.t.Error("Expected to find a label with name `filename` but did not!") return } if _, ok := h.receivedMap[file]; ok { diff --git a/pkg/promtail/targets/filetarget.go b/pkg/promtail/targets/filetarget.go index 755e997dffc294388dc8841e89e6c0dfab905c9e..0b0d19cf6668415ab80fab7a6ae605c272bab32e 100644 --- a/pkg/promtail/targets/filetarget.go +++ b/pkg/promtail/targets/filetarget.go @@ -46,7 +46,7 @@ var ( ) const ( - filenameLabel = "__filename__" + filenameLabel = "filename" ) // Config describes behavior for Target