Skip to content

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

clusters/apps/env/production/observability/otel/collector/pod-logging.yaml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec:
3636
- /var/log/pods/*/*/*.log
3737
exclude:
3838
- /var/log/pods/*/otc-container/*.log
39-
start_at: end
39+
start_at: beginning
4040
storage: file_storage
4141
include_file_path: true
4242
include_file_name: false
@@ -45,6 +45,8 @@ spec:
4545
- type: router
4646
id: get-format
4747
routes:
48+
- output: parser-docker
49+
expr: 'body matches "^\\{"'
4850
- output: parser-crio
4951
expr: 'body matches "^[^ Z]+ "'
5052
- output: parser-containerd
@@ -82,26 +84,23 @@ spec:
8284
regex: '^.*\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[a-f0-9\-]{36})\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$'
8385
parse_from: attributes["log.file.path"]
8486
cache:
85-
size: 128 # default maximum amount of Pods per Node is 110
87+
size: 128 # default maximum amount of Pods per Node is 110
8688
# Rename attributes
8789
- type: move
88-
from: attributes.stream
89-
to: attributes["log.iostream"]
90+
from: attributes["log.file.path"]
91+
to: resource["filename"]
9092
- type: move
9193
from: attributes.container_name
92-
to: resource["k8s.container.name"]
94+
to: resource["container"]
9395
- type: move
9496
from: attributes.namespace
95-
to: resource["k8s.namespace.name"]
97+
to: resource["namespace"]
9698
- type: move
9799
from: attributes.pod_name
98-
to: resource["k8s.pod.name"]
99-
- type: move
100-
from: attributes.restart_count
101-
to: resource["k8s.container.restart_count"]
102-
- type: move
103-
from: attributes.uid
104-
to: resource["k8s.pod.uid"]
100+
to: resource["pod"]
101+
- type: add
102+
field: resource["cluster"]
103+
value: 'main-lyh' # Set your cluster name here
105104
filelog/1:
106105
include:
107106
- /var/log/syslog
@@ -162,12 +161,12 @@ spec:
162161
- from: connection
163162
resource/loki0:
164163
attributes:
165-
- action: insert
166-
key: loki.resource.labels
167-
value: event.domain, k8s.resource.name, k8s.pod.name, k8s.pod.uid, k8s.deployment.name, k8s.namespace.name, k8s.node.name, k8s.pod.start_time, k8s.container.name, container.image.name, container.image.tag, instance, environment, severity, app, log.iostream, log
168164
- action: insert
169165
key: loki.format
170166
value: raw
167+
- action: insert
168+
key: loki.resource.labels
169+
value: pod, namespace, container, cluster, filename
171170
resource/loki1:
172171
attributes:
173172
- action: insert
@@ -215,10 +214,9 @@ spec:
215214
pipelines:
216215
logs/0:
217216
receivers:
218-
- otlp
219217
- filelog/0
220218
processors:
221-
- k8sattributes
219+
#- k8sattributes
222220
- resource/loki0
223221
- batch
224222
exporters:

0 commit comments

Comments
 (0)