server:
http_listen_address: "0.0.0.0"
http_listen_port: 9380
grpc_listen_port: 0
positions:
filename: "/opt/promtail/positions.yml"
clients:
- url: "https://loki-distributor.service.infra-jp-aws.consul/loki/api/v1/push"
external_labels:
env: "{{ env }}"
basic_auth:
username: "promtail"
password_file: "/opt/promtail/secrets/loki.password"
scrape_configs:
- job_name: "docker"
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: "5s"
relabel_configs:
- source_labels: ['__meta_docker_container_label_com_hashicorp_nomad_alloc_id']
target_label: "alloc_id"
- source_labels: ['__meta_docker_container_label_com_hashicorp_nomad_namespace']
target_label: "namespace"
- source_labels: ['__meta_docker_container_label_com_hashicorp_nomad_job_name']
target_label: "job"
- source_labels: ['__meta_docker_container_label_com_hashicorp_nomad_task_group_name']
target_label: "group"
- source_labels: ['__meta_docker_container_label_com_hashicorp_nomad_task_name']
target_label: "task"
pipeline_stages:
- static_labels:
source: nomad
- match: # loki
selector: '{job="loki",group=~"loki-.*"}'
pipeline_name: "loki"
stages:
- regex:
expression: '^level=(?P<level>\S+) ts=(?P<time>\S+).*$'
- timestamp:
source: time
format: "RFC3339Nano"
- static_labels:
filtered: "true"
- match: # grafana
selector: '{job="grafana",group="grafana",task="grafana"}'
pipeline_name: "grafana"
stages:
- regex:
expression: '^t=(?P<time>\S+) lvl=(?P<level>\S+).*$'
- timestamp:
source: time
format: "2006-01-02T15:04:05-0700"
- static_labels:
filtered: "true"
- match: # patroni
selector: '{job="patroni",group="patroni",task="patroni"}'
pipeline_name: "patroni"
stages:
- multiline:
firstline: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}'
- regex:
expression: '^(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\,\d{3}).*'
- timestamp:
source: time
format: "2006-01-02 15:04:05,999"
- drop:
expression: ".*INFO: no action.*"
drop_counter_reason: "noise-filter"
- static_labels:
filtered: "true"
- match: # drop
selector: '{filtered!="true"}'
action: drop
drop_counter_reason: "nomad-filter"
- labeldrop:
- filtered
у вас локи поднять на k8s?
когда запускал: promtail | level=error ts=2022-05-10T11:37:50.533826714Z caller=refresh.go:98 component=docker_discovery discovery=docker msg="Unable to refresh target groups" err="error while listing containers: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
Ну что написано, то и проверяй. Докер запущен, сокет на месте, права у промтейла есть на скрейп?
докер работает, сокет есть, дал права к promtail
уже решил но появился новый promtail | level=error caller=target_group.go:95 msg="added Docker target" containerID=blablalala
Обсуждают сегодня