Skip to content
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

Fix single job with multiple service discovery elements #1770

Merged
merged 1 commit into from
Mar 3, 2020

Conversation

adityacs
Copy link
Collaborator

@adityacs adityacs commented Mar 3, 2020

What this PR does / why we need it:
Fix single job with multiple service discovery elements

Which issue(s) this PR fixes:
Fixes #1754

@rfratto Kindly review

Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking into this @adityacs! This LGTM aside from my one nit.

pkg/promtail/targets/filetargetmanager.go Outdated Show resolved Hide resolved
Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks again! Waiting for CI to pass and I'll merge.

@rfratto rfratto merged commit 6f3489e into grafana:master Mar 3, 2020
@zswanson
Copy link

zswanson commented Sep 6, 2020

@adityacs @rfratto this seems to have regressed, I'm seeing the same issue in promtail 1.6.0 with a similar config as the original issue.

scrape_configs:
  - job_name: centos
    pipeline_stages: [<stuff>]
    static_configs:
      - targets: ['localhost']
        labels:
          job: varlogs
          __path__: /var/log/messages
      - targets: ['localhost']
        labels:
          job: varlogs
          __path__: /var/log/secure

@adityacs
Copy link
Collaborator Author

adityacs commented Sep 8, 2020

@zswanson This is not a regression. You have to make sure the labels are unique. Try following configuration

static_configs:
      - targets: ['localhost']
        labels:
          job: varlogs
          log_name: messages
          __path__: /var/log/messages
      - targets: ['localhost']
        labels:
          job: varlogs
          log_name: secure_log
          __path__: /var/log/secure

@zswanson
Copy link

zswanson commented Sep 8, 2020

I see, ok. I thought that the __path__ internal label, that gets translated to filename when stored in loki, handled that uniqueness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promtail: allow single job with multiple service discovery elements
3 participants