promtail: Move hard-coded config to prometheus_agent.agents.promtail.config inventory key
This commit is contained in:
parent
71c00d0cce
commit
7d0415ecf6
2 changed files with 48 additions and 46 deletions
|
|
@ -1,49 +1,8 @@
|
|||
server:
|
||||
disable: true
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /var/lib/promtail/positions.yaml
|
||||
|
||||
clients:
|
||||
{% if 'clients' not in prometheus_agent.agents.promtail.config %}
|
||||
{% set tmp = prometheus_agent.agents.promtail.config.setdefault('clients', []) %}
|
||||
{% for i in prometheus_agent.scrapers if prometheus_agent.scrapers[i].get("loki") %}
|
||||
{% set lokiconfig = {}|combine({ "external_labels": merged_prometheus_labels|combine( {"instance": inventory_hostname} ) }, prometheus_agent.scrapers[i]['loki'] ) %}
|
||||
- {{ lokiconfig|to_json }}
|
||||
{% set tmp = prometheus_agent.agents.promtail.config.clients.append(lokiconfig) %}
|
||||
{% endfor %}
|
||||
|
||||
scrape_configs:
|
||||
- job_name: system
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: varlogs
|
||||
__path__: /var/log/*log
|
||||
- job_name: journal
|
||||
journal:
|
||||
max_age: 12h
|
||||
labels:
|
||||
job: systemd-journal
|
||||
relabel_configs:
|
||||
- source_labels: ['__journal__systemd_unit']
|
||||
target_label: 'unit'
|
||||
- source_labels: ['__journal_priority_keyword']
|
||||
target_label: 'level'
|
||||
pipeline_stages:
|
||||
- structured_metadata:
|
||||
level:
|
||||
- job_name: nginx
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: nginx
|
||||
__path__: /var/log/nginx/access-promtail.log
|
||||
- job_name: postfix-bounces
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: postfix-bounces
|
||||
__path__: /var/log/mailman3/bounce.log
|
||||
{% endif %}
|
||||
{{ prometheus_agent.agents.promtail.config|to_nice_yaml(indent=2) }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue