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: resource_attributes:
attributes_config: attributes_config:
- action: index_label - action: index_label
attributes: regex: app
- app - action: index_label
- env regex: environment
- k8s.pod.name
- k8s.namespace.name
- k8s.node.name
# -- Provides a reloadable runtime configuration file for some specific configuration # -- Provides a reloadable runtime configuration file for some specific configuration
runtimeConfig: {} runtimeConfig: {}
# -- Check https://grafana.com/docs/loki/latest/configuration/#common_config for more info on how to provide a common configuration # -- 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 - context: log
statements: statements:
- set(log.body["kubernetes"], log.attributes["kubernetes"]) - set(log.body["kubernetes"], log.attributes["kubernetes"])
- set(log.attributes["app"], log.attributes["context"]["app"]) - set(log.attributes["service.name"], log.attributes["context"]["app"])
- set(log.attributes["environment"], log.attributes["context"]["env"]) - set(log.attributes["deployment.environment"], log.attributes["context"]["env"])
batch: batch:
send_batch_size: 5 send_batch_size: 5
timeout: 10s timeout: 10s