fix(loki): update resource_attributes to use regex for indexing labels

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-04-21 17:05:53 +08:00
parent f45f79e32e
commit c106c9a624
2 changed files with 5 additions and 8 deletions

View File

@ -352,12 +352,9 @@ loki:
resource_attributes:
attributes_config:
- action: index_label
attributes:
- app
- env
- k8s.pod.name
- k8s.namespace.name
- k8s.node.name
regex: app
- action: index_label
regex: environment
# -- Provides a reloadable runtime configuration file for some specific configuration
runtimeConfig: {}
# -- Check https://grafana.com/docs/loki/latest/configuration/#common_config for more info on how to provide a common configuration

View File

@ -48,8 +48,8 @@ spec:
- context: log
statements:
- set(log.body["kubernetes"], log.attributes["kubernetes"])
- set(log.attributes["app"], log.attributes["context"]["app"])
- set(log.attributes["environment"], log.attributes["context"]["env"])
- set(log.attributes["service.name"], log.attributes["context"]["app"])
- set(log.attributes["deployment.environment"], log.attributes["context"]["env"])
batch:
send_batch_size: 5
timeout: 10s