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

Add promtail_systemd_service variable (needed to configure multiple promtail instances). #73

Merged
merged 2 commits into from
Jan 13, 2022

Conversation

aberes
Copy link
Contributor

@aberes aberes commented Dec 27, 2021

Introduce promtail_systemd_service variable (defaults to promtail). Replace hardcoded references to promtail systemd service with {{ promtail_systemd_service }}.
Needed to configure multiple promtail instances.

…eplace hardcoded references to promtail systemd service with {{ promtail_systemd_service }}
@patrickjahns
Copy link
Owner

Hello @aberes

Thanks for the contribution - could you share a bit more on the use-case of configuring more than a single promtail?

Promtail itself is quite versatile with pipelines and destinations (and routing to them) - so I am not quite sure if the role needs to support the use-case

@patrickjahns patrickjahns added the enhancement New feature or request label Dec 28, 2021
@aberes
Copy link
Contributor Author

aberes commented Jan 12, 2022

Hello @patrickjahns

We use two promtail instances for our servers: one for system services and journald (it sends logs to our own loki instance) and other - for application services (it sends logs to grafana cloud for our developers).
First promtail instance runs under root privileges (due to restricted log files access). Both instances have different setup for clients: section.

Example (for system services and journald instance):

- name: Setting promtail_config_scrape_configs
  set_fact:
    promtail_config_scrape_configs: '{{ global_promtail_system_config_scrape_configs + group_promtail_system_config_scrape_configs + host_promtail_system_config_scrape_configs }}'

- name: Configuring promtail
  include_role:
    name: patrickjahns.promtail
  vars:
    promtail_config_dir: /etc/promtail-system
    promtail_system_user: root
    promtail_user_additional_groups:
    promtail_systemd_service: promtail-system
    promtail_config_server:
      disable: true
    # promtail_system_pass is defined in group_vars/all/vault
    promtail_config_clients:
      - url: 'XXX'
        basic_auth:
          username: 'promtail'
          password: '{{ promtail_system_pass }}'
        external_labels:
          host: '{{ inventory_hostname }}'

@patrickjahns patrickjahns added the semver:minor Change leading to a minor level version bump label Jan 13, 2022
@patrickjahns
Copy link
Owner

@aberes

Thank you very much for sharing - happy to include the change with the next release

@patrickjahns patrickjahns merged commit c17c081 into patrickjahns:master Jan 13, 2022
@github-actions github-actions bot mentioned this pull request Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver:minor Change leading to a minor level version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants