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

promtail static_configs targets can have any value #1831

Closed
Mario-Hofstaetter opened this issue Mar 21, 2020 · 3 comments
Closed

promtail static_configs targets can have any value #1831

Mario-Hofstaetter opened this issue Mar 21, 2020 · 3 comments
Labels
stale A stale issue or PR that will automatically be closed.

Comments

@Mario-Hofstaetter
Copy link
Contributor

Describe the bug
Documentation https://github.com/grafana/loki/blob/v1.3.0/docs/clients/promtail/configuration.md#static_config
states that in static_config:

# Configures the discovery to look on the current machine. Must be either
# localhost or the hostname of the current computer.
targets:
  - localhost

However, this is not enforced, and has no effect?

To Reproduce
Run promtail with a scrape_configs containing:

    static_configs:
      - targets:
          - "foobar"

on a machine not named foobar 😄
Service Discovery shows __address__="foobar",
but logs are pushed to loki correctly. __address__ label is not visible inside grafana.

Expected behavior
??? Is this an unused config value when running static?
Does this have any effect?

Environment:

  • Promtail bare-metal on Windows 10, 1909
@adityacs
Copy link
Contributor

adityacs commented Mar 28, 2020

@Mario-Hofstaetter The labels with __ is dropped here https://github.com/grafana/loki/blob/master/pkg/promtail/targets/filetargetmanager.go#L249

If you want to add host label, You can add an extra label under labels

labels:
      job: varlogs
      __path__: /var/log/*log
      hostname: systemhostname

@cyriltovena
Copy link
Contributor

cyriltovena commented Mar 28, 2020

__address__ and __host__ are not available those are labels used only during scrapping. You could still add them via relabelling or pipeline stage or even like @adityacs suggested.

And yes:

# Configures the discovery to look on the current machine. Must be either
# localhost or the hostname of the current computer.
targets:
  - localhost

is not used in Loki and doesn't have side effects.

Feel free to send a PR to update the documentation.

@stale
Copy link

stale bot commented Apr 27, 2020

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.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Apr 27, 2020
@stale stale bot closed this as completed May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale A stale issue or PR that will automatically be closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants