Updated promtail config

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2021-11-27 21:02:05 +00:00
parent 8bfcfbe770
commit 769fdff851
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78

View File

@ -67,7 +67,7 @@ data:
target_config: target_config:
sync_period: 10s sync_period: 10s
scrape_configs: scrape_configs:
- job_name: kubernetes-pods-name - job_name: kubernetes-pods
pipeline_stages: pipeline_stages:
- docker: {} - docker: {}
- match: - match:
@ -85,398 +85,478 @@ data:
- match: - match:
selector: '{app="internal-proxy"}' selector: '{app="internal-proxy"}'
action: drop action: drop
# - match:
# selector: '{k8s_app="traefik-ingress-lb"}'
# stages:
# - json:
# expressions:
# request_host: RequestHost
# request_path: RequestPath
# error: error
# - drop:
# source: "request_path"
# value: "/healthz"
# - template:
# source: has_error
# template: '{{ if .error }}true{{ else }}false{{ end }}'
# - labels:
# request_host:
# has_error:
kubernetes_sd_configs: kubernetes_sd_configs:
- role: pod - role: pod
relabel_configs: relabel_configs:
- source_labels: - source_labels:
- __meta_kubernetes_pod_label_name - __meta_kubernetes_pod_controller_name
target_label: __service__ regex: ([0-9a-z-.]+?)(-[0-9a-f]{8,10})?
- source_labels: action: replace
- __meta_kubernetes_pod_node_name target_label: __tmp_controller_name
target_label: __host__ - source_labels:
- action: drop - __meta_kubernetes_pod_label_app_kubernetes_io_name
regex: '' - __meta_kubernetes_pod_label_app
source_labels: - __tmp_controller_name
- __service__ - __meta_kubernetes_pod_name
- action: labelmap regex: ^;*([^;]+)(;.*)?$
regex: __meta_kubernetes_pod_label_(.+) action: replace
- action: replace target_label: app
replacement: $1 - source_labels:
separator: / - __meta_kubernetes_pod_label_app_kubernetes_io_component
source_labels: - __meta_kubernetes_pod_label_component
- __meta_kubernetes_namespace regex: ^;*([^;]+)(;.*)?$
- __service__ action: replace
target_label: job target_label: component
- action: replace - action: replace
source_labels: source_labels:
- __meta_kubernetes_namespace - __meta_kubernetes_pod_node_name
target_label: namespace target_label: node_name
- action: replace - action: replace
source_labels: source_labels:
- __meta_kubernetes_pod_name - __meta_kubernetes_namespace
target_label: pod target_label: namespace
- action: replace - action: replace
source_labels: replacement: $1
- __meta_kubernetes_pod_container_name separator: /
target_label: container source_labels:
- replacement: /var/log/pods/*$1/*.log - namespace
separator: / - app
source_labels: target_label: job
- __meta_kubernetes_pod_uid - action: replace
- __meta_kubernetes_pod_container_name source_labels:
target_label: __path__ - __meta_kubernetes_pod_name
target_label: pod
- action: replace
source_labels:
- __meta_kubernetes_pod_container_name
target_label: container
- action: replace
replacement: /var/log/pods/*$1/*.log
separator: /
source_labels:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- action: replace
replacement: /var/log/pods/*$1/*.log
regex: true/(.*)
separator: /
source_labels:
- __meta_kubernetes_pod_annotationpresent_kubernetes_io_config_hash
- __meta_kubernetes_pod_annotation_kubernetes_io_config_hash
- __meta_kubernetes_pod_container_name
target_label: __path__
- job_name: kubernetes-pods-app # - job_name: kubernetes-pods-name
pipeline_stages: # pipeline_stages:
- docker: {} # - docker: {}
- match: # - match:
selector: '{name="weave-net"}' # selector: '{name="weave-net"}'
action: drop # action: drop
- match: # - match:
selector: '{filename=~".*konnectivity.*"}' # selector: '{filename=~".*konnectivity.*"}'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*/healthz.*"' # selector: '{name=~".*"} |~ ".*/healthz.*"'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*kube-probe/.*"' # selector: '{name=~".*"} |~ ".*kube-probe/.*"'
action: drop # action: drop
- match: # - match:
selector: '{app="internal-proxy"}' # selector: '{app="internal-proxy"}'
action: drop # action: drop
# - match: # # - match:
# selector: '{k8s_app="traefik-ingress-lb"}' # # selector: '{k8s_app="traefik-ingress-lb"}'
# stages: # # stages:
# - json: # # - json:
# expressions: # # expressions:
# request_host: RequestHost # # request_host: RequestHost
# request_path: RequestPath # # request_path: RequestPath
# error: error # # error: error
# - drop: # # - drop:
# source: "request_path" # # source: "request_path"
# value: "/healthz" # # value: "/healthz"
# - template: # # - template:
# source: has_error # # source: has_error
# template: '{{ if .error }}true{{ else }}false{{ end }}' # # template: '{{ if .error }}true{{ else }}false{{ end }}'
# - labels: # # - labels:
# request_host: # # request_host:
# has_error: # # has_error:
kubernetes_sd_configs: # kubernetes_sd_configs:
- role: pod # - role: pod
relabel_configs: # relabel_configs:
- action: drop # - source_labels:
regex: .+ # - __meta_kubernetes_pod_label_name
source_labels: # target_label: __service__
- __meta_kubernetes_pod_label_name # - source_labels:
- source_labels: # - __meta_kubernetes_pod_node_name
- __meta_kubernetes_pod_label_app # target_label: __host__
target_label: __service__ # - action: drop
- source_labels: # regex: ''
- __meta_kubernetes_pod_node_name # source_labels:
target_label: __host__ # - __service__
- action: drop # - action: labelmap
regex: '' # regex: __meta_kubernetes_pod_label_(.+)
source_labels: # - action: replace
- __service__ # replacement: $1
- action: labelmap # separator: /
regex: __meta_kubernetes_pod_label_(.+) # source_labels:
- action: replace # - __meta_kubernetes_namespace
replacement: $1 # - __service__
separator: / # target_label: job
source_labels: # - action: replace
- __meta_kubernetes_namespace # source_labels:
- __service__ # - __meta_kubernetes_namespace
target_label: job # target_label: namespace
- action: replace # - action: replace
source_labels: # source_labels:
- __meta_kubernetes_namespace # - __meta_kubernetes_pod_name
target_label: namespace # target_label: pod
- action: replace # - action: replace
source_labels: # source_labels:
- __meta_kubernetes_pod_name # - __meta_kubernetes_pod_container_name
target_label: pod # target_label: container
- action: replace # - replacement: /var/log/pods/*$1/*.log
source_labels: # separator: /
- __meta_kubernetes_pod_container_name # source_labels:
target_label: container # - __meta_kubernetes_pod_uid
- replacement: /var/log/pods/*$1/*.log # - __meta_kubernetes_pod_container_name
separator: / # target_label: __path__
source_labels:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- job_name: kubernetes-pods-direct-controllers # - job_name: kubernetes-pods-app
pipeline_stages: # pipeline_stages:
- docker: {} # - docker: {}
- match: # - match:
selector: '{name="weave-net"}' # selector: '{name="weave-net"}'
action: drop # action: drop
- match: # - match:
selector: '{filename=~".*konnectivity.*"}' # selector: '{filename=~".*konnectivity.*"}'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*/healthz.*"' # selector: '{name=~".*"} |~ ".*/healthz.*"'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*kube-probe/.*"' # selector: '{name=~".*"} |~ ".*kube-probe/.*"'
action: drop # action: drop
- match: # - match:
selector: '{app="internal-proxy"}' # selector: '{app="internal-proxy"}'
action: drop # action: drop
# - match: # # - match:
# selector: '{k8s_app="traefik-ingress-lb"}' # # selector: '{k8s_app="traefik-ingress-lb"}'
# stages: # # stages:
# - json: # # - json:
# expressions: # # expressions:
# request_host: RequestHost # # request_host: RequestHost
# request_path: RequestPath # # request_path: RequestPath
# error: error # # error: error
# - drop: # # - drop:
# source: "request_path" # # source: "request_path"
# value: "/healthz" # # value: "/healthz"
# - template: # # - template:
# source: has_error # # source: has_error
# template: '{{ if .error }}true{{ else }}false{{ end }}' # # template: '{{ if .error }}true{{ else }}false{{ end }}'
# - labels: # # - labels:
# request_host: # # request_host:
# has_error: # # has_error:
kubernetes_sd_configs: # kubernetes_sd_configs:
- role: pod # - role: pod
relabel_configs: # relabel_configs:
- action: drop # - action: drop
regex: .+ # regex: .+
separator: '' # source_labels:
source_labels: # - __meta_kubernetes_pod_label_name
- __meta_kubernetes_pod_label_name # - source_labels:
- __meta_kubernetes_pod_label_app # - __meta_kubernetes_pod_label_app
- action: drop # target_label: __service__
regex: '[0-9a-z-.]+-[0-9a-f]{8,10}' # - source_labels:
source_labels: # - __meta_kubernetes_pod_node_name
- __meta_kubernetes_pod_controller_name # target_label: __host__
- source_labels: # - action: drop
- __meta_kubernetes_pod_controller_name # regex: ''
target_label: __service__ # source_labels:
- source_labels: # - __service__
- __meta_kubernetes_pod_node_name # - action: labelmap
target_label: __host__ # regex: __meta_kubernetes_pod_label_(.+)
- action: drop # - action: replace
regex: '' # replacement: $1
source_labels: # separator: /
- __service__ # source_labels:
- action: labelmap # - __meta_kubernetes_namespace
regex: __meta_kubernetes_pod_label_(.+) # - __service__
- action: replace # target_label: job
replacement: $1 # - action: replace
separator: / # source_labels:
source_labels: # - __meta_kubernetes_namespace
- __meta_kubernetes_namespace # target_label: namespace
- __service__ # - action: replace
target_label: job # source_labels:
- action: replace # - __meta_kubernetes_pod_name
source_labels: # target_label: pod
- __meta_kubernetes_namespace # - action: replace
target_label: namespace # source_labels:
- action: replace # - __meta_kubernetes_pod_container_name
source_labels: # target_label: container
- __meta_kubernetes_pod_name # - replacement: /var/log/pods/*$1/*.log
target_label: pod # separator: /
- action: replace # source_labels:
source_labels: # - __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name # - __meta_kubernetes_pod_container_name
target_label: container # target_label: __path__
- replacement: /var/log/pods/*$1/*.log
separator: /
source_labels:
- __meta_kubernetes_pod_uid
- __meta_kubernetes_pod_container_name
target_label: __path__
- job_name: kubernetes-pods-indirect-controller # - job_name: kubernetes-pods-direct-controllers
pipeline_stages: # pipeline_stages:
- docker: {} # - docker: {}
- match: # - match:
selector: '{name="weave-net"}' # selector: '{name="weave-net"}'
action: drop # action: drop
- match: # - match:
selector: '{filename=~".*konnectivity.*"}' # selector: '{filename=~".*konnectivity.*"}'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*/healthz.*"' # selector: '{name=~".*"} |~ ".*/healthz.*"'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*kube-probe/.*"' # selector: '{name=~".*"} |~ ".*kube-probe/.*"'
action: drop # action: drop
- match: # - match:
selector: '{app="internal-proxy"}' # selector: '{app="internal-proxy"}'
action: drop # action: drop
# - match: # # - match:
# selector: '{k8s_app="traefik-ingress-lb"}' # # selector: '{k8s_app="traefik-ingress-lb"}'
# stages: # # stages:
# - json: # # - json:
# expressions: # # expressions:
# request_host: RequestHost # # request_host: RequestHost
# request_path: RequestPath # # request_path: RequestPath
# error: error # # error: error
# - drop: # # - drop:
# source: "request_path" # # source: "request_path"
# value: "/healthz" # # value: "/healthz"
# - template: # # - template:
# source: has_error # # source: has_error
# template: '{{ if .error }}true{{ else }}false{{ end }}' # # template: '{{ if .error }}true{{ else }}false{{ end }}'
# - labels: # # - labels:
# request_host: # # request_host:
# has_error: # # has_error:
kubernetes_sd_configs: # kubernetes_sd_configs:
- role: pod # - role: pod
relabel_configs: # relabel_configs:
- action: drop # - action: drop
regex: .+ # regex: .+
separator: '' # separator: ''
source_labels: # source_labels:
- __meta_kubernetes_pod_label_name # - __meta_kubernetes_pod_label_name
- __meta_kubernetes_pod_label_app # - __meta_kubernetes_pod_label_app
- action: keep # - action: drop
regex: '[0-9a-z-.]+-[0-9a-f]{8,10}' # regex: '[0-9a-z-.]+-[0-9a-f]{8,10}'
source_labels: # source_labels:
- __meta_kubernetes_pod_controller_name # - __meta_kubernetes_pod_controller_name
- action: replace # - source_labels:
regex: '([0-9a-z-.]+)-[0-9a-f]{8,10}' # - __meta_kubernetes_pod_controller_name
source_labels: # target_label: __service__
- __meta_kubernetes_pod_controller_name # - source_labels:
target_label: __service__ # - __meta_kubernetes_pod_node_name
- source_labels: # target_label: __host__
- __meta_kubernetes_pod_node_name # - action: drop
target_label: __host__ # regex: ''
- action: drop # source_labels:
regex: '' # - __service__
source_labels: # - action: labelmap
- __service__ # regex: __meta_kubernetes_pod_label_(.+)
- action: labelmap # - action: replace
regex: __meta_kubernetes_pod_label_(.+) # replacement: $1
- action: replace # separator: /
replacement: $1 # source_labels:
separator: / # - __meta_kubernetes_namespace
source_labels: # - __service__
- __meta_kubernetes_namespace # target_label: job
- __service__ # - action: replace
target_label: job # source_labels:
- action: replace # - __meta_kubernetes_namespace
source_labels: # target_label: namespace
- __meta_kubernetes_namespace # - action: replace
target_label: namespace # source_labels:
- action: replace # - __meta_kubernetes_pod_name
source_labels: # target_label: pod
- __meta_kubernetes_pod_name # - action: replace
target_label: pod # source_labels:
- action: replace # - __meta_kubernetes_pod_container_name
source_labels: # target_label: container
- __meta_kubernetes_pod_container_name # - replacement: /var/log/pods/*$1/*.log
target_label: container # separator: /
- replacement: /var/log/pods/*$1/*.log # source_labels:
separator: / # - __meta_kubernetes_pod_uid
source_labels: # - __meta_kubernetes_pod_container_name
- __meta_kubernetes_pod_uid # target_label: __path__
- __meta_kubernetes_pod_container_name
target_label: __path__
- job_name: kubernetes-pods-static # - job_name: kubernetes-pods-indirect-controller
pipeline_stages: # pipeline_stages:
- docker: {} # - docker: {}
- match: # - match:
selector: '{name="weave-net"}' # selector: '{name="weave-net"}'
action: drop # action: drop
- match: # - match:
selector: '{filename=~".*konnectivity.*"}' # selector: '{filename=~".*konnectivity.*"}'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*/healthz.*"' # selector: '{name=~".*"} |~ ".*/healthz.*"'
action: drop # action: drop
- match: # - match:
selector: '{name=~".*"} |~ ".*kube-probe/.*"' # selector: '{name=~".*"} |~ ".*kube-probe/.*"'
action: drop # action: drop
- match: # - match:
selector: '{app="internal-proxy"}' # selector: '{app="internal-proxy"}'
action: drop # action: drop
# - match: # # - match:
# selector: '{k8s_app="traefik-ingress-lb"}' # # selector: '{k8s_app="traefik-ingress-lb"}'
# stages: # # stages:
# - json: # # - json:
# expressions: # # expressions:
# request_host: RequestHost # # request_host: RequestHost
# request_path: RequestPath # # request_path: RequestPath
# error: error # # error: error
# - drop: # # - drop:
# source: "request_path" # # source: "request_path"
# value: "/healthz" # # value: "/healthz"
# - template: # # - template:
# source: has_error # # source: has_error
# template: '{{ if .error }}true{{ else }}false{{ end }}' # # template: '{{ if .error }}true{{ else }}false{{ end }}'
# - labels: # # - labels:
# request_host: # # request_host:
# has_error: # # has_error:
kubernetes_sd_configs: # kubernetes_sd_configs:
- role: pod # - role: pod
relabel_configs: # relabel_configs:
- action: drop # - action: drop
regex: '' # regex: .+
source_labels: # separator: ''
- __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror # source_labels:
- action: replace # - __meta_kubernetes_pod_label_name
source_labels: # - __meta_kubernetes_pod_label_app
- __meta_kubernetes_pod_label_component # - action: keep
target_label: __service__ # regex: '[0-9a-z-.]+-[0-9a-f]{8,10}'
- source_labels: # source_labels:
- __meta_kubernetes_pod_node_name # - __meta_kubernetes_pod_controller_name
target_label: __host__ # - action: replace
- action: drop # regex: '([0-9a-z-.]+)-[0-9a-f]{8,10}'
regex: '' # source_labels:
source_labels: # - __meta_kubernetes_pod_controller_name
- __service__ # target_label: __service__
- action: labelmap # - source_labels:
regex: __meta_kubernetes_pod_label_(.+) # - __meta_kubernetes_pod_node_name
- action: replace # target_label: __host__
replacement: $1 # - action: drop
separator: / # regex: ''
source_labels: # source_labels:
- __meta_kubernetes_namespace # - __service__
- __service__ # - action: labelmap
target_label: job # regex: __meta_kubernetes_pod_label_(.+)
- action: replace # - action: replace
source_labels: # replacement: $1
- __meta_kubernetes_namespace # separator: /
target_label: namespace # source_labels:
- action: replace # - __meta_kubernetes_namespace
source_labels: # - __service__
- __meta_kubernetes_pod_name # target_label: job
target_label: pod # - action: replace
- action: replace # source_labels:
source_labels: # - __meta_kubernetes_namespace
- __meta_kubernetes_pod_container_name # target_label: namespace
target_label: container # - action: replace
- replacement: /var/log/pods/*$1/*.log # source_labels:
separator: / # - __meta_kubernetes_pod_name
source_labels: # target_label: pod
- __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror # - action: replace
- __meta_kubernetes_pod_container_name # source_labels:
target_label: __path__ # - __meta_kubernetes_pod_container_name
# target_label: container
# - replacement: /var/log/pods/*$1/*.log
# separator: /
# source_labels:
# - __meta_kubernetes_pod_uid
# - __meta_kubernetes_pod_container_name
# target_label: __path__
# - job_name: kubernetes-pods-static
# pipeline_stages:
# - docker: {}
# - match:
# selector: '{name="weave-net"}'
# action: drop
# - match:
# selector: '{filename=~".*konnectivity.*"}'
# action: drop
# - match:
# selector: '{name=~".*"} |~ ".*/healthz.*"'
# action: drop
# - match:
# selector: '{name=~".*"} |~ ".*kube-probe/.*"'
# action: drop
# - match:
# selector: '{app="internal-proxy"}'
# action: drop
# # - match:
# # selector: '{k8s_app="traefik-ingress-lb"}'
# # stages:
# # - json:
# # expressions:
# # request_host: RequestHost
# # request_path: RequestPath
# # error: error
# # - drop:
# # source: "request_path"
# # value: "/healthz"
# # - template:
# # source: has_error
# # template: '{{ if .error }}true{{ else }}false{{ end }}'
# # - labels:
# # request_host:
# # has_error:
# kubernetes_sd_configs:
# - role: pod
# relabel_configs:
# - action: drop
# regex: ''
# source_labels:
# - __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror
# - action: replace
# source_labels:
# - __meta_kubernetes_pod_label_component
# target_label: __service__
# - source_labels:
# - __meta_kubernetes_pod_node_name
# target_label: __host__
# - action: drop
# regex: ''
# source_labels:
# - __service__
# - action: labelmap
# regex: __meta_kubernetes_pod_label_(.+)
# - action: replace
# replacement: $1
# separator: /
# source_labels:
# - __meta_kubernetes_namespace
# - __service__
# target_label: job
# - action: replace
# source_labels:
# - __meta_kubernetes_namespace
# target_label: namespace
# - action: replace
# source_labels:
# - __meta_kubernetes_pod_name
# target_label: pod
# - action: replace
# source_labels:
# - __meta_kubernetes_pod_container_name
# target_label: container
# - replacement: /var/log/pods/*$1/*.log
# separator: /
# source_labels:
# - __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror
# - __meta_kubernetes_pod_container_name
# target_label: __path__
--- ---
kind: ClusterRole kind: ClusterRole