I deployed promtail daemonset in my k8s to collect my application logs.
I want to add some K8S node or pod labels, but when i query logs in grafana, i did not see any k8s labels and only labels in static_configs can be found.
Here is my configmap for promtail, can you help me?
apiVersion: v1
kind: ConfigMap
metadata:
name: promtail
namespace: prod
labels:
app: promtail
data:
promtail.yaml: |
client:
backoff_config:
max_period: 5m
max_retries: 10
min_period: 500ms
batchsize: 1048576
batchwait: 1s
external_labels: {}
timeout: 10s
positions:
filename: /run/promtail/positions.yaml
server:
http_listen_port: 3101
target_config:
sync_period: 10s
scrape_configs:
- job_name: applogs
kubernetes_sd_configs: - role: node
relabel_configs: - source_labels: [__meta_kubernetes_pod_node_name]
target_label: node_name - source_labels: [__meta_kubernetes_pod_host_ip]
target_label: node_ip
static_configs: - targets:
- localhost
labels:
job: myapp
path: /xxx/xxx/xxx/x.log