-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promtail drops static_configs target although file __path__ is differnt #3698
Comments
all xx label will be removed for k := range labels {
if strings.HasPrefix(string(k), "__") {
delete(labels, k)
}
}
....
level.Info(s.log).Log("msg", "Adding target", "key", key)
t, err := s.newTarget(string(path), labels, discoveredLabels) as the value of path passed to go-tail library, I am not sure the tail is support regex, you can look into this, if not support you may need add an extra label for differ. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
I believe this behavior to be unintuitive for users, the need to add "junk" labels just so multiple log files are not ignored by promtail. Is this something loki devs would reconsider? Can't PR anything myself unfortunately. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This issue seems to be resolved by #4599 ✅ I just compiled static_configs:
- labels:
__path__: "C:/temp/log1.log.json"
app: "myapp"
- labels:
__path__: "C:/temp/log2.log.json"
app: "myapp" resulting in this behavior: I have not yet tested if logs from both files are correctly tailed and pushed to loki but it looks promising. |
I met the same problem and must use the |
Describe the bug
One application may have several different logfiles (in different locations).
Using two entries in
static_configs
of ajob
with DIFFERENT__path__
values, but otherwise the same set oflabels
, causes promtail to drop one of the configurations (Dropped: ignoring target, already exists
) and not tailing the logfile.To Reproduce
promtail.exe
Version2.2.1
on Windows 10 bare metalpromtail-config.yaml
:(
job
label removed for brevity)There is only one target active in http://127.0.0.1:9080/targets
Expected behavior
IMHO both targets should be used as this is what a user would expect?
The
__path__
label is after all stored in loki asfilename
, so I guess promtail can use the path label for target uniqueness?Changing one of the
"localhost"
values oftargets:
is not helping, because__address__
is also ignored (See also #1831)To fix the issue, one has to add an actual dummy label (❓):
Which is unfortunate because labels decrease loki performance (chunks, best practices docs, ...)
Am I doing something wrong?
Issue #1754 sounding similar, but OP there already used actual labels with different labels.
Environment:
promtail.exe
Version1.2.1
on bare metal.The text was updated successfully, but these errors were encountered: