fix: align authentication logging with chat service configuration

- Add parse_to: attributes to json_parser operator
- Add move operator to move text content to body
- Use application instead of service_name for consistency
- Use global.environment for environment setting
- Add global.environment to values files for both alpha and prod
- This should fix the unknown_service classification issue
This commit is contained in:
Nicolas 2025-09-22 21:21:19 +08:00
parent fe2b7200de
commit 802698bcb7
3 changed files with 10 additions and 3 deletions

View File

@ -52,6 +52,10 @@ spec:
operators: operators:
- type: json_parser - type: json_parser
parse_from: body parse_from: body
parse_to: attributes
- type: move
from: attributes.text
to: body
processors: processors:
resource: resource:
attributes: attributes:
@ -77,9 +81,8 @@ spec:
log_statements: log_statements:
- context: log - context: log
statements: statements:
- set(resource.attributes["service.name"], "authentication") - set(resource.attributes["application"], "authentication")
- set(resource.attributes["service_name"], "authentication") - set(resource.attributes["environment"], "{{ .Values.global.environment | default .Release.Namespace }}")
- set(resource.attributes["environment"], "alpha")
- set(resource.attributes["pod_ip"], resource.attributes["k8s.pod.ip"]) - set(resource.attributes["pod_ip"], resource.attributes["k8s.pod.ip"])
- set(resource.attributes["pod_name"], resource.attributes["k8s.pod.name"]) - set(resource.attributes["pod_name"], resource.attributes["k8s.pod.name"])
- set(resource.attributes["kubernetes_node_name"], resource.attributes["k8s.node.name"]) - set(resource.attributes["kubernetes_node_name"], resource.attributes["k8s.node.name"])

View File

@ -9,6 +9,8 @@ logIngest:
lokiEndpoint: http://loki-gateway.freeleaps-logging-system lokiEndpoint: http://loki-gateway.freeleaps-logging-system
logPathPattern: /app/log/authentication/*.log logPathPattern: /app/log/authentication/*.log
logPath: /app/log/authentication logPath: /app/log/authentication
global:
environment: alpha
authentication: authentication:
replicas: 1 replicas: 1
image: image:

View File

@ -12,6 +12,8 @@ logIngest:
lokiEndpoint: http://loki-gateway.freeleaps-logging-system lokiEndpoint: http://loki-gateway.freeleaps-logging-system
logPathPattern: /app/log/authentication/*.log logPathPattern: /app/log/authentication/*.log
logPath: /app/log/authentication logPath: /app/log/authentication
global:
environment: prod
authentication: authentication:
replicas: 1 replicas: 1
image: image: