Skip to content

Commit

Permalink
Steal code from promtail to allow alloy to read journal
Browse files Browse the repository at this point in the history
  • Loading branch information
Aethylred committed May 21, 2024
1 parent 5e76dbb commit 04b2d4e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions roles/alloy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ grafana_alloy_config: |
url = "http://mimir:9009/api/v1/push"
}
}
# Stolen from promtail to allow Alloy to read /var/log/messages
grafana_alloy_runtime_mode: "acl" # Supported "root" or "acl"
grafana_alloy_user_append_groups:
- "systemd-journal"
14 changes: 14 additions & 0 deletions roles/alloy/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@
create_home: false # Appropriate for a system user, usually doesn't need a home directory
become: true

# Mercilessly stealing from promtail to allow Alloy to read /var/log/messages etc.
- name: Add the Alloy system user to additional group
ansible.builtin.user:
name: "{{ grafana_alloy_service_user }}"
groups: "{{ item }}"
system: true
append: true
create_home: false
state: present
loop: "{{ grafana_alloy_user_append_groups }}"
when:
- grafana_alloy_user_append_groups | length > 0
- grafana_alloy_runtime_mode == "acl"

- name: Download alloy binary
ansible.builtin.get_url:
url: "{{ grafana_alloy_binary_url }}"
Expand Down

0 comments on commit 04b2d4e

Please sign in to comment.