|
36 | 36 | - /var/log/pods/*/*/*.log
|
37 | 37 | exclude:
|
38 | 38 | - /var/log/pods/*/otc-container/*.log
|
39 |
| - start_at: end |
| 39 | + start_at: beginning |
40 | 40 | storage: file_storage
|
41 | 41 | include_file_path: true
|
42 | 42 | include_file_name: false
|
|
45 | 45 | - type: router
|
46 | 46 | id: get-format
|
47 | 47 | routes:
|
| 48 | + - output: parser-docker |
| 49 | + expr: 'body matches "^\\{"' |
48 | 50 | - output: parser-crio
|
49 | 51 | expr: 'body matches "^[^ Z]+ "'
|
50 | 52 | - output: parser-containerd
|
@@ -82,26 +84,23 @@ spec:
|
82 | 84 | regex: '^.*\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[a-f0-9\-]{36})\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$'
|
83 | 85 | parse_from: attributes["log.file.path"]
|
84 | 86 | 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 |
86 | 88 | # Rename attributes
|
87 | 89 | - type: move
|
88 |
| - from: attributes.stream |
89 |
| - to: attributes["log.iostream"] |
| 90 | + from: attributes["log.file.path"] |
| 91 | + to: resource["filename"] |
90 | 92 | - type: move
|
91 | 93 | from: attributes.container_name
|
92 |
| - to: resource["k8s.container.name"] |
| 94 | + to: resource["container"] |
93 | 95 | - type: move
|
94 | 96 | from: attributes.namespace
|
95 |
| - to: resource["k8s.namespace.name"] |
| 97 | + to: resource["namespace"] |
96 | 98 | - type: move
|
97 | 99 | 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 |
105 | 104 | filelog/1:
|
106 | 105 | include:
|
107 | 106 | - /var/log/syslog
|
@@ -162,12 +161,12 @@ spec:
|
162 | 161 | - from: connection
|
163 | 162 | resource/loki0:
|
164 | 163 | 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 |
168 | 164 | - action: insert
|
169 | 165 | key: loki.format
|
170 | 166 | value: raw
|
| 167 | + - action: insert |
| 168 | + key: loki.resource.labels |
| 169 | + value: pod, namespace, container, cluster, filename |
171 | 170 | resource/loki1:
|
172 | 171 | attributes:
|
173 | 172 | - action: insert
|
@@ -215,10 +214,9 @@ spec:
|
215 | 214 | pipelines:
|
216 | 215 | logs/0:
|
217 | 216 | receivers:
|
218 |
| - - otlp |
219 | 217 | - filelog/0
|
220 | 218 | processors:
|
221 |
| - - k8sattributes |
| 219 | + #- k8sattributes |
222 | 220 | - resource/loki0
|
223 | 221 | - batch
|
224 | 222 | exporters:
|
|
0 commit comments